1、添加登陆账号

USE [master]
GO
CREATE LOGIN [USERNAME] WITH PASSWORD=N'XXXXXX', DEFAULT_DATABASE=[DBNAME], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO


2、添加数据库登陆名
USE [DBNAME]
GO
CREATE USER [USERNAME] FOR LOGIN [USERNAME]
GO
grant select,update,execute on schema::dbo to USERNAME;
GO


3、授予管理权限
EXEC master..sp_addsrvrolemember @loginame = N'USERNAME', @rolename = N'sysadmin';