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
 General SQL Server Forums
 New to SQL Server Programming
 sql statment history

Author  Topic 

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-03-01 : 04:34:39
I wanted to knw how to get the last 10 SQL Statments issued by the
users client to the SQL Server.


dbcc inputbuffer (spid) gives us the last statement how to get a
history of statments by a SPID.


madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-01 : 04:47:04
I think you can make use of Profiler

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

activecrypt
Posting Yak Master

165 Posts

Posted - 2006-03-03 : 02:06:42
Hi,
SPID will change when ever new connection established,suppose spid 90 is assigned to machine10 and machine10 is disconnected from sql / close application , and then new machine ,machine17 connected to sql / application and it will assigned a new spid to machine17 and when machine10 re-connect to sql it will not assign the same spid to the same system. So you can not find the last 10 statements from the SPID.
1). You can make use of Profiler to refer statements issued from Client System
or
2). You can use some third party softwares for the audit

:-)
Regards


Andy Davis
Sql Shield Team
--------------------------------------------
SQL Server Encryption Software
http://www.sql-shield.com
Go to Top of Page
   

- Advertisement -