tags:

views:

40

answers:

2

I am creating a new login in my SQL Server and I want to check if the login exists, if not, then I have to execute the following query to create a new login.

Can anyone help me in checking whether the login exists or not using query?

USE [master]
GO
CREATE LOGIN [Emsmgr1] WITH PASSWORD=N'welcome', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
+1  A: 

Try querying select name from master..syslogins

Rob Farley
+1  A: 

See if this will help you

How to check whether SQL login exists?

astander