XLeratorDB/util Online Documentation
UserExists
Updated: 30 October 2008
Use wct.UserExists to determine if the specified user exists in the database.
Syntax
SELECT [westclintech].[wct].[UserExists](
<@UserName, nvarchar(4000),>)
Arguments
@UserName
is the name of user being tested for on the database. @UserName is an expression of the character string data type category.
Return Types
bit
Remarks
· UserExists simplifies SQL intended to drop a user account if it exists.
Example
IF (wct.UserExists('someuser') <> 0) EXEC dbo.sp_revokedbaccess N'someuser'
Here is the result set
----------------------
Command(s) completed successfully