IF EXISTS (SELECT * FROM sys.all_objects WHERE name = N'SOMELOGIN')
DROP USER [SOMELOGIN]
GO
Does not work because USER SOMELOGIN
does not live in sys.all_objects
.
Is there a global "god" table I can look in to see if something exists. (i.e. dropping it when it doesn't exist doesn't throw an error)
Alternatively is there an online resource for finding out where certain types of objects live?
I need to drop the following
USER
ASYMMETRIC KEY
LOGIN
CERTIFICATE