|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Getting query processing time
I want to get the time it takes to run a query.
Is there a way to get it ? for example a system variable or stored proc ? I can get the "current time" before and after the query, and subtract them, but I want only the "time" part, and I want to Insert the time in a column of a table. how can I do it ? |
|
#2
|
|||
|
|||
|
Hi,
I created a table b for storing query execution information as below create table b ( id int identity(1,1), time_in_ms bigint, query ntext ) GO Then I prepared the query and the execution time calculations in the following statements declare @s datetime declare @e datetime declare @sql nvarchar(4000) select @s = getdate(), @sql = N'select * from Octopus..RIS' exec sp_executesql @sql select @e = getdate() insert into b select datediff(ms,@s,@e), @sql You can see the results in milliseconds stored in the table b select * from b Eralper http://www.kodyaz.com |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Getting query processing time |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|