I\'d like to drop a user in a SQL Server script but I\'ll need to test for existence first or I\'ll get script errors. When dropping tables or stored procs, I check the sys
SSMS scripts it in the following way:
For SQL 2005/2008:
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'username') DROP USER [username]
For SQL 2000:
IF EXISTS (SELECT * FROM dbo.sysusers WHERE name = N'username') EXEC dbo.sp_revokedbaccess N'username'