You can achive this using SQL Profiler. You need not to do any programming/coding for this.
See at Books Online..
You can do it programatically also...
Here the sample code..
Code Snippet
DECLARE @.StartDateTime DATETIME
DECLARE @.EndDateTime DATETIME
DECLARE @.Msg VARCHAR(200)
DECLARE @.RC as Int
SELECT @.StartDateTime = GETDATE()
EXEC YOURSP / QUERY
SELECT @.RC = @.@.ROWCOUNT, @.EndDateTime = GETDATE()
SELECT @.Msg = 'Your SP Name' + CONVERT(VARCHAR(10),@.RC) + ' ' + CONVERT(VARCHAR(25), DATEDIFF(MS, @.StartDateTime, @.EndDateTime)) + 'ms'
PRINT @.Msg
|||instead of above code use sp_who.
|||there have to be something like just one command|||
Luis:
Maybe SET STATISTICS TIME ON and SET STATISTICS TIME OFF?
sql
No comments:
Post a Comment