What is the best way to check if there is a login in SQL Server 2005
I am looking for the best way to check that the database login exists in SQL Server 2005. I am currently using
IF suser_sid('loginname') IS NOT NULL
but suser_sid () returns a value in some cases when the login does not exist.
In SQL 2000 we use
SELECT * FROM [Master].[dbo].[sysxlogins] WHERE [name] ='loginname'
but this table doesn't exist in SQL 2005.
There is a similar question about checking the existence of users , which is helpful, but I'm looking for the existence of logins.
+1
source to share