471,119 Members | 1,366 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 software developers and data experts.

Is user logged-on?

Dear Group

I wondered whether there's a function or script that will show me
whether a user is currently logged-on to a MSSQL 2000 database? I'm
using SQL Authentication.

Thanks very much for your help & efforts!
Have a nice day!

Martin
Jul 23 '05 #1
2 1497
You can use sp_who or sp_who2, or if you need something from code then
a statement like this will work:

if exists (select * from master.dbo.sysprocesses
where loginame = 'MyLogin'
and dbid = db_id('MyDB'))
begin
/* Do something here */
end

Simon

Jul 23 '05 #2
Hi Simon!

Thanks for the message. Works great!

M

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ghazan Haider | last post: by
3 posts views Thread by Alan Silver | last post: by
3 posts views Thread by Lattis | last post: by
1 post views Thread by Chris | last post: by
2 posts views Thread by =?Utf-8?B?Q2hyaXM=?= | last post: by
33 posts views Thread by JamesB | last post: by
1 post views Thread by GoGoRichie | last post: by
3 posts views Thread by R.A.M. | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.