473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 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 1565
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ghazan Haider | last post by:
Is there a way for a PHP script to know which machine/user is accessing the script? The html headers at best show the client machine name/IP but not the user. so... Can AciveX be used to see...
3
by: Alan Silver | last post by:
Hello, I have some pages that are protected by forms authentication, and am adding code to the global.asax so that if someone tries to load (say) /order83.aspx, if they are logged in, it will...
2
by: _thedebugger | last post by:
Dear friends, I am developing one shopping cart application. My requirement is if user logged in one machine, he should not logged into from another db. how should I do that. I am using sql...
3
by: Lattis | last post by:
I have the following problem: User A is logged in to a windows 2000 terminal. He runs an application which runs under the credentials of a different user. If I try to see the current user...
1
by: Chris | last post by:
Hi, i created a default page with loginview and loginstatus like this: <asp:LoginView ID="LoginView1" runat="server"> <LoggedInTemplate>You are logged</LoggedInTemplate>...
2
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
Hi, I am using a win32 function, LogonUser, to impersonate a user across a WCF service. I have noticed that everytime I call this function, a new logon session is created for that user, meaning...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
1
by: GoGoRichie | last post by:
Does anyone know away i can pull the logged in user name from a computer for a web form? this is what i did to pull from the cookie when user log into my site but now i want to get request...
3
by: R.A.M. | last post by:
Hello, I have created ASP.NET application with aspnetdb database. In the following codeI have an error: System.Security.Principal.IPrincipal user = HttpContext.Current.User; if...
0
by: sandeepkavade | last post by:
Hi i want to impersonate the process in SYSTEM, Logged in user and specified user. for Specified user i am giving the username and password and impersonation is working fine. The code is taken from...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.