Ask the Expert

Preventing users from having more than one login session open at once

I created a database in MS SQL Server 2000. Everything was working great until I found that a user can login to the server more than once at the same time. Is there a way to prevent this, especially the first login using a normal login screen and the second login using Query Analyzer?

    Requires Free Membership to View

SQL Server is a data repository and not a full access control system. Your database application should be the one in charge of controlling access to the back-end data. One popular way that I've seen this performed is by having the application login using one set of credentials and then managing the user credentials inside your custom application. This way, when a user attempts to login concurrently, your application can query a "currently logged in" users list and display the appropriate error message. The user's password won't allow him into Query Analyzer so there's no harm in attempting a connection.

This was first published in May 2006

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: