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 Development (2000)
 how to find last executed query in sql server

Author  Topic 

Rohan
Starting Member

3 Posts

Posted - 2008-06-19 : 05:16:14
hi..

how to find last(latest) executed query in sql server 2000 ...

regards ,
Rohan

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-06-19 : 06:01:14
look at DBCC INPUTBUFFER
http://msdn.microsoft.com/en-us/library/ms187730.aspx


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

Rohan
Starting Member

3 Posts

Posted - 2008-06-19 : 20:48:14
Actually i want log the query executed in stored procedure ..
any way of doing it in sql server 2000
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-20 : 02:17:18
quote:
Originally posted by Rohan

Actually i want log the query executed in stored procedure ..
any way of doing it in sql server 2000


you mean retrieve the last executed query and put it into log table in a procedure?
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-06-20 : 22:58:05
DBCC inputbuffer won't give you last executed query .It will give you query for SPID you provide.You have to track with profiler .
Go to Top of Page
   

- Advertisement -