January 4, 2012 at 1:44 am
Hi, folks!
Is there any way to capture the text output of a multiline dynamic TSQL query into a TSQL variable?
NB: "the text output" means all I can see in the messages tab of a query window in SSMS, e.g. the warnings, row counts, results of PRINT statements and so on.
Seems to me I'm looking for a functionality similar to the @query parameter of "sp_send_dbmail", but within a TSQL script/ procedure.
Any ideas?
Regards from Berlin/Germany
SeBaFlu
January 4, 2012 at 5:06 am
You could try capturing the statements using trace events. You just need to be careful because that will capture lots of information. Either turn it on then turn it off immediately or provide enough filtering to avoid capturing too much information, probably both.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply