August 28, 2007 at 10:11 pm
I have an requirement of inserting the output of "DBCC inputbuffer "
into a table variable..
I tried with the following query,
DECLARE @T3 TABLE
(
A SYSNAME,
B SYSNAME,
[INPUT_BUFFER] NVARCHAR(1200),[SPID] INT NULL
);
INSERT @T3(A,B,[INPUT_BUFFER])
EXEC SP_EXECUTESQL ('DBCC INPUTBUFFER(55)WITH NO_INFOMSGS')
But the sql server prompts me that
"Server: Msg 197, Level 15, State 1, Line 12
EXECUTE cannot be used as a source when inserting into a table variable."
I can accomplish the same using #tables (temporary tables ).
Can any one suggest a way to accomplish the same using tables variables..
Regards,
Paarthasarathy K, Chennai
(Life is Full of Compilation Errors and Unhandled Exceptions )
Kindest Regards,
Paarthasarathy
Microsoft Certified Technology Specialist
http://paarthasarathyk.blogspot.com
August 28, 2007 at 10:41 pm
Why so hell-bent on using table variables? They live in the exact same place that Temp Tables do and have the disadvantage of not using statistics. Use the Temp Table ![]()
If you're trying to do this in a function, that's a whole 'nother story... personnally, I wouldn't try to do this in a function... perhaps a sproc but not a UDF.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply