How to Check if a login exists in SQL Server ?

If you need to check if a login exists in SQL Server , you can use query the master.dbo.syslogins for it.

How to Check if a login exists in SQL Server ?

Here’s a sample query demonstrating how you can query master.dbo.syslogins to find out if the login exists in SQL Server.

Select * from master.dbo.syslogins 
where name = 'sa'

This would retreive all the details of the loginid ‘sa’.

image