Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 set statistics profile on to table

Author  Topic 

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2014-07-23 : 18:32:47
How can I insert the results of "set statistics profile on" into a table?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-07-24 : 13:00:54
You could try wrapping it into sp_executesql.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

nathans
Aged Yak Warrior

938 Posts

Posted - 2014-07-25 : 13:22:34
Sounds like you want to capture query stats into a table for aggregation / analysis? If so, this is already happening for the most part in the sys.dm_exec_query_stats DMV.

see: http://msdn.microsoft.com/en-us/library/ms189741.aspx

If you need it at the request level you might try what Tara suggested, but i'm not sure that will give you a tabular stream; you might be forced to parse the string in a client to get at the metrics. SQLCLR maybe?

Another route might be to use SQL Profiler to capture the reads/writes, etc. and stash them into a table.

Go to Top of Page
   

- Advertisement -