Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 TSQL - Delete SQL Login

Author  Topic 

youruseridistoxic
Yak Posting Veteran

65 Posts

Posted - 2008-09-02 : 09:37:34
Books online tells me to use the following;

DROP LOGIN login_name
GO

But all this returns is;

Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'LOGIN'.


Am I missing something here? This should be quite simple....

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-02 : 09:42:58
EXEC sp_droplogin login_name

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

youruseridistoxic
Yak Posting Veteran

65 Posts

Posted - 2008-09-02 : 09:57:04
quote:
Originally posted by madhivanan

EXEC sp_droplogin login_name

Madhivanan

Failing to plan is Planning to fail



Thank you, however now the resulting message is;

The login 'testuser' does not exist.

The exact syntax I am using is;

EXEC sp_droplogin 'testuser'. I have attempted this in both the master db, and the application db. Both produce the same error. This user clearly exists both under Security (Server) and Users (database).

I am using the same cred's to create the user as I am to delete it, so access rights should not be an issue.

Where am I going wrong?
Go to Top of Page

youruseridistoxic
Yak Posting Veteran

65 Posts

Posted - 2008-09-02 : 11:32:33
quote:
Originally posted by youruseridistoxic

quote:
Originally posted by madhivanan

EXEC sp_droplogin login_name

Madhivanan

Failing to plan is Planning to fail



Thank you, however now the resulting message is;

The login 'testuser' does not exist.

The exact syntax I am using is;

EXEC sp_droplogin 'testuser'. I have attempted this in both the master db, and the application db. Both produce the same error. This user clearly exists both under Security (Server) and Users (database).

I am using the same cred's to create the user as I am to delete it, so access rights should not be an issue.

Where am I going wrong?




Figured it out;

"...sp_drop_login is intended to be use only be used for SQL-authenticated
logins, although SQL 2000 apparently didn't enforce the requirement. Use sp_revokelogin to remove Windows-authenticated logins. That should work in both versions."

Go to Top of Page
   

- Advertisement -