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.
| Author |
Topic |
|
nitin1353
Constraint Violating Yak Guru
381 Posts |
Posted - 2008-08-25 : 02:45:50
|
| GurusI am little confused in thisPlease helpI 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.aspxI 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 inputbufferPlease helpNitin |
|
|
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) |
 |
|
|
nitin1353
Constraint Violating Yak Guru
381 Posts |
Posted - 2008-08-25 : 02:59:05
|
| Thanks for the prompt replyBut why do we use "SELECT request_id FROM sys.dm_exec_requests WHERE session_id = @@spid"ThanksNitin |
 |
|
|
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 |
 |
|
|
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?ThanksNitin |
 |
|
|
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?ThanksNitin
they got it by thisselect @@spidsp_who2 also displays it (and all others too). so you need to distinguish it based on hostname and status. |
 |
|
|
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 adviceThanksNitin |
 |
|
|
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 adviceThanksNitin
nope. it returns the session id of current user process. |
 |
|
|
|
|
|