Monday, May 14, 2012

MIcrosoft SQL Server:Create New Database User for Login.

** Execute this Query **

USE [master]
GO
 

CREATE LOGIN [LoginName] WITH PASSWORD=N'Password', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
 

USE [DatabaseName]
GO
 

CREATE USER [DatabaseUserName] FOR LOGIN [LoginName]
GO
 

USE [DatabaseName]
GO
 

EXEC sp_addrolemember N'db_datareader', N'DatabaseUserName'
GO

No comments:

Post a Comment

Dear User,

Thank you very much for your kind response