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: Thursday, December 11, 2014 11:23 AM
Points: 337, Visits: 598
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


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:13 PM
Points: 5,316, Visits: 12,347
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.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
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: Thursday, December 11, 2014 11:23 AM
Points: 337, Visits: 598
Ok, thanks... will do.
Post #1376617
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse