以系统管理员的身份登录,然后执行下述语句将指定用户的角色改为sysadmin
EXEC master.dbo.sp_addsrvrolemember @loginame = N'用户名', @rolename = N'sysadmin'
查看用户数据库角色
select DbRole = g.name, MemberName = u.name, MemberSID = u.sid
from sys.database_principals u, sys.database_principals g, sys.database_role_members m
where g.principal_id = m.role_principal_id
and u.principal_id = m.member_principal_id
查看用户服务器角色
select 用户名 = u.name,管理员权限 = g.name,是否在用 = u.is_disabled,MemberSID = u.sid
from sys.server_principals u, sys.server_principals g, sys.server_role_members m
where g.principal_id = m.role_principal_id
and u.principal_id = m.member_principal_id
and g.name = 'sysadmin'