十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
SELECT 'EXEC master..sp_addsrvrolemember @loginame = N'''+loginname+''', @rolename = N'''+priv+''''
FROM
(
SELECT loginname, priv, value
FROM
(
SELECT loginname, sysadmin, securityadmin, serveradmin, setupadmin, processadmin, diskadmin, dbcreator, bulkadmin
FROM sys.syslogins
) AS a UNPIVOT(value FOR priv IN(sysadmin, securityadmin, serveradmin, setupadmin, processadmin, diskadmin, dbcreator, bulkadmin)) AS UPV
) AS T
WHERE VALUE = 1;
![](/upload/otherpic45/171158.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)