I have created a stored procedure that pulls sp_who2 information to a table, "myTable" for running queries against. When this stored procedure is called through SSRS by a end user to see who is in the database prior to creating a manual backup. It is creating the table; however, it is assigning it to a different schema. It is creating the table as domain\user.myTable.
Is there any way to get it to create just the table as "myTable" instead of the domain\user.myTable?
Here is the code for the stored procedure. Thanks in advance.
GO
ALTER Procedure [dbo].[WhoIsInCareKeeper]
(
@databaseName sysname
)
AS
BEGIN
CREATE TABLE myTable (
spid int
, ecid int
, status varchar(50)
, loginame varchar(255)
, hostname varchar(255)
, blk varchar(50)
, dbname varchar(255)
, cmd varchar(255)
, requestid int
)
INSERT INTO myTable EXEC sp_who
SELECT DISTINCT loginame, dbname, hostname FROM myTable
WHERE dbname = @databaseName
DROP TABLE myTable
END