- --Create a test library first test_tmp
- --Create two tables based on an existing table
- SELECT TOP to test_tab1 from Mistest_09428.dbo.squarer;
- SELECT TOP to test_tab2 from Mistest_09428.dbo.squarer;
- --Create a role
EXEC sp_addrole ' Test_role1 ';
- 11.
12.--Assign the permissions of select to the role test_role1
GRANT SELECT on TEST_TAB1 to Test_role1;
GRANT SELECT on test_tab2 to Test_role1;
- 15.
--add login dap570, password dap570, default library is test_tmp
. EXEC sp_addlogin ' dap570 ', ' dap570 ', ' test_tmp ';
- 18.
19.--Add the account test to dap570
EXEC sp_grantdbaccess ' dap570 ', ' Test '
- 21st.
22.--Assign the role test_role1 to text
. EXEC sp_addrolemember ' test_role1 ', ' test ';
--over.
- 25.
26.--Change dap570 to log in to the database test_tmp
- 27.
28.--Then test
- 29.
30./*
. DELETE from Test_tab1
- 32.
. INSERT into Test_tab1 (ingotno) VALUES (' 2222 ')
- 34.
UPDATE test_tab1 SET ingotno = ' 3333 '
Read-only permission assignment for SQL Server tables