Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL statement run info in Stored Proc Expand / Collapse
Author
Message
Posted Tuesday, October 23, 2012 1:00 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 9:33 AM
Points: 310, Visits: 537
When you run a sql statement, in Server Management Studio, it tells you how many rows and how long it took, how do you get a stored Proc to capture this info in the Job history?

So if you have a Stored Proc that runs two statements: Select - into statement.. and an insert into statment.. it would log how long each took and how may rows each statement inserted.
Post #1376211
Posted Tuesday, October 23, 2012 1:47 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Monday, July 21, 2014 11:49 PM
Points: 4,973, Visits: 11,660
dwilliscp (10/23/2012)
When you run a sql statement, in Server Management Studio, it tells you how many rows and how long it took, how do you get a stored Proc to capture this info in the Job history?

So if you have a Stored Proc that runs two statements: Select - into statement.. and an insert into statment.. it would log how long each took and how may rows each statement inserted.


Look up @@RowCount in BOL for number of rows affected.

For execution times, just capture getdate() before and after the statements are executed and do a quick calculation.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1376224
Posted Wednesday, October 24, 2012 12:08 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 9:33 AM
Points: 310, Visits: 537
Ok, thanks... will do.
Post #1376617
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse