How sqlserver permissions assigned to a user can only view a certain view of rights and a table

 

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'

 

 

6, assign permissions to roles table (table name JD_ProductCard role name seeview)

grant select on JD_ProductCard to seeview

 

grant update on JD_ProductCard to seeview

 

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'

Guess you like

Origin www.cnblogs.com/allen1991/p/11412565.html