exec sp_addrole ' Guestview '
--grant SELECT on Veiw to [Guestview];
GRANT SELECT on CustomerInfo to Guestview;
--exec sp_addlogin ' client ', ' [email protected] ', ' Iccard_tanghe '
--exec sp_adduser ' guest ', ' guest ', Guestview;
1. Select the database in SQL Server that you want to manipulate
2,--current database creation role
exec sp_addrole ' Seeview '--created a database role named: [Seeview]
3,--Assigning View permissions GRANT SELECT on veiw to [role]
--Specifies the View list specifies seeview This role can see the view of the name of the chart, that is, this role can be viewed below to give these views information, in addition to all things are not seen
grant select on v_viewname1 to SEEVIEW
grant Select on v_viewname2 to seeview
4,--add only users who are allowed access to the specified view: EXEC sp_addlogin ' login name ', ' Password ', ' default database name '
EXEC sp_addlogin ' guest ', ' guest ', ' OA '
may not be able to execute here, require password strength, then you create it manually I did not execute the success
5,--add only users who are allowed access to the specified view into the RCRM role: exec sp_adduser ' login name ', ' username ', ' role '
exec sp_adduser ' guest ', ' guest ', 'seeview '
How SQL Server assigns a user permission to view only one view