Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize


SQL Server 2000

Removes the login entries from Microsoft® SQL Server™ for a Microsoft Windows NT® user or group created with sp_grantlogin or sp_denylogin.


sp_revokelogin [ @loginame = ] 'login'


[@loginame =] 'login'

Is the name of the Windows NT user or group. login is sysname, with no default. login can be any existing Windows NT username or group in the form Domain\User.

Return Code Values

0 (success) or 1 (failure)


sp_revokelogin does not explicitly prevent Windows NT users from connecting to SQL Server, but prevents Windows NT users from doing so through their Windows NT user accounts. However, Windows NT users can still connect if they are members of a Windows NT group that has been granted access to SQL Server using the sp_grantlogin stored procedure. For example, if Windows NT user REDMOND\john is a member of the Windows NT group REDMOND\Admins, and REDMOND\john is revoked access using:

sp_revokelogin [REDMOND\john]

REDMOND\john can still connect if REDMOND\Admins is granted access. Similarly, if REDMOND\Admins is revoked access but REDMOND\john is granted access, REDMOND\john can still connect.

Use sp_denylogin to explicitly prevent users from connecting with SQL Server, regardless of their Windows NT group memberships.

Use sp_droplogin to remove a SQL Server login added with sp_addlogin.

sp_revokelogin cannot be executed within a user-defined transaction.


Only members of the sysadmin or securityadmin fixed server roles can execute sp_revokelogin.


This example removes the login entries for the Windows NT user Corporate\MollyA.

EXEC sp_revokelogin 'Corporate\MollyA'


EXEC sp_revokelogin [Corporate\MollyA]

See Also




System Stored Procedures

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft