I want to add a where clause into the below statement but cant figure our the syntax
INSERT INTO #tmpUsers EXEC SP_WHO
I want to add WHERE loginame = 'myname'
I want to add a where clause into the below statement but cant figure our the syntax
INSERT INTO #tmpUsers EXEC SP_WHO
I want to add WHERE loginame = 'myname'
SQL 2008 では、次のように実行できます。
DECLARE @tmpUsers table ( spid INT, ecid INT, STATUS VARCHAR(MAX), loginame VARCHAR(50), hostname VARCHAR(50), blk BIT,
dbname VARCHAR(MAX), cmd VARCHAR(MAX), request_id INT )
INSERT INTO @tmpUsers
EXEC sp_who @loginame = 'sa'
SELECT * FROM @tmpUsers
ここでパラメータのリファレンスを見ることができます: http://technet.microsoft.com/en-us/library/ms174313.aspx