Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 12:27 PM
Points: 401, Visits: 746
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 @ 7:36 PM
Points: 7,278, Visits: 17,648
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.

Never attribute to malice that which is adequately explained by stupidity
Post #1376224
Posted Wednesday, October 24, 2012 12:08 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 12:27 PM
Points: 401, Visits: 746
Ok, thanks... will do.
Post #1376617
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse