USE [master]
GO
CREATE LOGIN [admin] WITH PASSWORD=N‘123456‘, DEFAULT_DATABASE=[test], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
EXEC master..sp_addsrvrolemember @loginame = N‘admin‘, @rolename = N‘dbcreator‘
GO
USE [test]
GO
CREATE USER [admin] FOR LOGIN [admin]
GO
USE [test]
GO
EXEC sp_addrolemember N‘db_owner‘, N‘admin‘
GO
mssql 动态添加数据库用户,布布扣,bubuko.com
时间: 2024-12-18 09:11:00