Tuesday, June 22, 2010

How to: Create login as sysadmin from T-SQL

Here is the T-SQL code snippet that creates login with sysadmin permissions.

CREATE LOGIN [nagasai] WITH PASSWORD=N'angel83', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
GO
EXEC master..sp_addsrvrolemember @loginame = N'nagasai', @rolename = N'sysadmin'

No comments:

Post a Comment