use master GO EXEC sp_addlogin 'infos1', '1', 'master' exec sp_grantdbaccess 'infos311' -- 给访问权限 USE [UniMessage]; grant select,insert,update,delete to [infos311] GO -- 创建用户 create login [infos1] with password='1'; go use [UniMessage]; go create user [infos1] from login [infos1]; go grant select,insert,update,delete to [infos1]; go -- 测试 execute as user='test1'; select SUSER_NAME() loginame,USER_NAME() username; --select * from dbo.Region; revert; use master GO --USE [UniMessage]; exec sp_droplogin 'infos2' EXEC sp_helpuser 'dbo'