Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 How can we see long running queries with tsql

Author  Topic 

jagpalsingh4
Starting Member

7 Posts

Posted - 2008-06-09 : 07:04:41
Hi,
Can anybody tell how can we see long running queries with tsql i have query for sql 2005 but it doesnt work with 2000.
so plz help me

Regards
Jagpal Singh


jagpalsingh

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2008-06-09 : 15:22:32
You can detect them with sp_who2, just like SQL 2005. You can see the command itself (or part of it) by either
DBCC INPUTBUFFER(spid)
or
::fn_get_sql()
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-06-09 : 15:24:34
You should view this information in SQL Profiler. After you have gathered the data and saved it into a table, run this to see your long-running queries:

SELECT TOP 1000 Duration, TextData
FROM YourTraceTable
WHERE TextData IS NOT NULL
ORDER BY Duration DESC

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -