Monitor sql connection from .Net SqlClient Data Provider

You can use the following sql script to monitor sql server processes and connections, whose function is almost the same as SP_Who &  SP_Who2.

Select  spid, uid = RTrim (loginame), program_name = RTrim (program_name),
dbname
= db_name (dbid), status = RTrim (status) 
From  master.dbo.sysprocesses
Where  loginame = ' sa or other login name '   and   db_name (dbid) = ' database name '  
 
AND  program_name = ' .Net SqlClient Data Provider '

eg.
Select  spid, uid = RTrim (loginame), program_name = RTrim (program_name),
dbname
= db_name (dbid), status = RTrim (status) 
From  master.dbo.sysprocesses
Where  loginame = ' sa '   and   db_name (dbid) = ' HRIS2004 '  
 
AND  program_name = ' .Net SqlClient Data Provider '

你可能感兴趣的:(Connection)