1/21/2013

Creating Login Users and Bind With Database User in MSSSQL

1)Add Login user to master db:
(To perform this operation, you need a valid login account information that can access master db)


CREATE LOGIN [AdminLogin]
WITH PASSWORD='XYZ'


2)Bind login user with db user:
(a default schema can also be used in the query)

CREATE USER AdminUser

FOR LOGIN AdminLogin

3)Giving insert,update permission to binded user:
(db_owner can be the best option for this)


EXEC sp_addrolemember N'db_owner', N'AdminUser'

NOTE:One login user can be used for many database users but for one database multiple users cannot be bind to same login user.



No comments:

Post a Comment