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 2005 Forums
 SQL Server Administration (2005)
 Help with DBCC Inputbuffer

Author  Topic 

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-08-25 : 02:45:50
Gurus
I am little confused in this
Please help
I understand that DBCC Inputbuffer Displays the last statement sent from a client to an instance of Microsoft SQL Server.

Now in reference to http://msdn.microsoft.com/en-us/library/ms187730.aspx

I have created a table in one window and i am running DBCC input buffer in another window but how will i come to know that which SPID i should use with DBCC inputbuffer

Please help
Nitin

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-25 : 02:49:47
use sp_who2 to get list of processes and look for one with your client machine name.(in HOSTNAME column)
Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-08-25 : 02:59:05
Thanks for the prompt reply
But why do we use "SELECT request_id
FROM sys.dm_exec_requests
WHERE session_id = @@spid"

Thanks
Nitin
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-25 : 03:41:35
thats returning the request id of current users process from dynamic management view sys.dm_exec_requests
Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-08-25 : 04:33:13
Can you please check this link whbich i sent and tell me how did they get SPID as 52?with sp_who2 or smething else?
Thanks
Nitin
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-25 : 05:22:29
quote:
Originally posted by nitin1353

Can you please check this link whbich i sent and tell me how did they get SPID as 52?with sp_who2 or smething else?
Thanks
Nitin


they got it by this

select @@spid

sp_who2 also displays it (and all others too). so you need to distinguish it based on hostname and status.
Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2008-08-25 : 06:24:57
Select @@spid will always display the SPid which is running against my insert statement??

Please advice

Thanks
Nitin
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-25 : 08:03:58
quote:
Originally posted by nitin1353

Select @@spid will always display the SPid which is running against my insert statement??

Please advice

Thanks
Nitin


nope. it returns the session id of current user process.
Go to Top of Page
   

- Advertisement -