Hi All,
Some times we need to know the all running/sleeping process in database. We can use the below code:--
SELECT 'These processes are using database' AS Note
,[Database]=DB_NAME(dbid), spid, last_batch,
status, hostname, loginame
FROM sys.sysprocesses
WHERE dbid = DB_ID('databaseName') ---Replace your database name with databaseName
0 Comment(s)