sql server创建只读用户访问指定表

 

exec sp_addlogin 用户名,密码,数据库
go
 
use 数据库
exec sp_grantdbaccess 用户名
go

use 数据库
grant select 
on 表名
to "用户名"

 

exec sp_addlogin ‘用户名‘,‘密码‘,‘数据库‘go use 数据库exec sp_grantdbaccess ‘用户名‘go
use 数据库grant select on 表名to “用户名”