SQLServer User permissions can only use view

How sqlserver only view permissions to a user a view of the distribution

exec sp_addrole 'guestview' 

--GRANT SELECT  ON veiw TO [guestview];

GRANT SELECT ON  CustomerInfo TO guestview;

--exec sp_addlogin 'client','Client@123','ICCard_TangHe'

--exec sp_adduser 'guest','guest',guestview;

 

1, choose a good database in sql server to operate in

2, - the current database to create a role 
exec sp_addrole 'seeview' - created a database role named: [seeview]

3, - assign permissions to view GRANT SELECT ON veiw TO [characters]

- Specify the name of table view list specifies the view seeview this role can be viewed; that is, this role can view the following information is given to these views, in addition to everything could not see
GRANT seeview the SELECT ON v_viewname1 the TO
GRANT the SELECT ON v_viewname2 TO seeview

4, - allow access only to add the user to specify view: exec sp_addlogin 'login', 'password', 'default database name'

exec sp_addlogin 'guest',''guest'','oa'

Here may not perform the required password strength, it would create my own hand did not execute successfully

5, - add only allow access to designated users to view rCRM roles: exec sp_adduser 'login', 'user name', 'role' 
Exec sp_adduser 'the Guest', 'the Guest', 'seeview'

Reprinted at: https://www.cnblogs.com/shi-yongcui/p/7755521.html

Guess you like

Origin blog.csdn.net/weixin_37641163/article/details/84339731