Posted by: the_hareeb September 29, 2010
how to find SPID of client program in SQL-Server
Login in to Rate this Post:     0       ?        
thanks guys.. will try this tomorrow.

virus,a quesitron for you..
IF EXISTS (SELECT * 
           FROM   tempdb.sys.objects 
           WHERE  object_id = Object_id('Tempdb.dbo.#cLIENTsPID')) 
  DROP TABLE #clientspid 

what does this do? Since we have '#', this means the table #cLIENTsPID will be dropped automatically once the session is over right? so why do we need to drop it. also what does this if exists section do.

if i understand it correctly, your script just creates a table from sp_who2. Please help me understand. Your help is appreciated. Sorry I am new to DBA.

thanks
Read Full Discussion Thread for this article