开发者

Permissions in SQL Server 2008

开发者 https://www.devze.com 2023-04-09 01:44 出处:网络
I have created 10 database of \'Northwind\' for training purpose. Suppose I have 10 students, so databases are Northwind_Student1,Northwind_Student2 etc. I wo开发者_开发技巧uld like to create separate

I have created 10 database of 'Northwind' for training purpose. Suppose I have 10 students, so databases are Northwind_Student1,Northwind_Student2 etc. I wo开发者_开发技巧uld like to create separate login for each pupil, so that Student1 can only see(or can access) the data base 'Northwind_Student1'. How can I accomplish this using T-SQL or SSMS 2008 ?


You can create different users for different databases and assign permissions like below. It's for SQL 2008, but it will be same for 2005 also :

Permissions in SQL Server 2008


In SSMS, expand the Security tree of the server in Object Explorer and right-click Logins to choose New Login..., then add as many as needed.

Then in the Security tree of each individual database, add the login as a user of that db and grant appropriate rights.


Create 10 different logins and assign each to the database it can access.


CREATE LOGIN yourloginname WITH PASSWORD = 'yourpassword'
0

精彩评论

暂无评论...
验证码 换一张
取 消