Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT MIN(SPID) FROM SYSPROCESSES WHERE DBID= <ID OF A DATABASE>

Status
Not open for further replies.

goofy

Programmer
Feb 3, 2001
30
0
0
US
Hi

&quot;SELECT MIN(SPID) FROM SYSPROCESSES WHERE DBID= <ID OF A DATABASE>&quot;

What is the possibility of getting a SPID 5 (which is a task manager - system process) while using a query specified above. Provided a database id is specified in the where clause

I used a above specified query with in a stored procedure and the SPID returned was 5

Thanks
 
This is a query I used, no problems with it as far as I recall


SELECT MIN(SPID) FROM Master..SYSPROCESSES WHERE DBID= DB_ID('DBName')
AND Master..SysProcesses.HOSTNAME <> ''

Maybe it solves your prob.

 
i want to know the usernames and spid for all the users who have signed in.

awaiting for ur favourable reply.
thanks
 
Try this

select top 1 spid,loginame from master..sysprocesses A
where cmd = 'task manager'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top