标题: SQLServer数据库如何创建只读的用户 [打印本页] 作者: 刘泽宇 时间: 2023-8-25 17:11 标题: SQLServer数据库如何创建只读的用户 可以执行如下SQL语句实现账号的创建和只读权限的授权:USE [master]
GO
CREATE LOGIN [test] WITH PASSWORD=test, DEFAULT_DATABASE=[TestDB], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON
GO
use [TestDB];
GO
use [master];
GO
USE [TestDB]
GO
CREATE USER [test] FOR LOGIN [test]
GO
USE [TestDB]
GO
ALTER ROLE [db_datareader] ADD MEMBER [test]
GO