September 12, 2008 at 10:03 am
I've written a small procedure that loops a table full of TSQL queries and uses sp_executesql to run those tsql statements.
I record the rows returned using @@rowcount as well as the time taken to run the query. I want to retrieve results from messages window programatically i.e the logical reads, physical reads etc...
Any idea how i can get this information?
The data i want to retrieve is in italics below >
thanks
r
set statistics io on
select * from sys.databases
Table 'syspalvalues'. Scan count 0, logical reads 288, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'syssingleobjrefs'. Scan count 0, logical reads 48, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'sysdbreg'. Scan count 1, logical reads 5, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
September 12, 2008 at 10:41 am
I'm watching this thread because others more knowledgable than me might throw something out there.
As far as I know, you can capture the print messages from an application, but not from within a stored procedure itself.I've done it in vb6 and vb.net. the vb6 ADODB.Command object or .NET's SQLCommand has the info you want....i don't think a native TSQL procedure , say calling another proc, can access the print statements....
a basic example can be found here:
capture-print-messages-from-a-stored-procedure.aspx;
you'll note that the messages come back after the procedure has executed.
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply