笔记151 判断登录用户是否是sysadmin角色

笔记151 判断登录用户是否是sysadmin角色

 1 --判断登录用户是否是sysadmin角色
 2 SELECT    name,Sid,type_desc,       
 3         IS_SRVROLEMEMBER('sysadmin', name)    AS    IsSysAdmin
 4 FROM    sys.server_principals p
 5 where name='JOE\Administrator'
 6 
 7 
 8 SELECT    name,Sid,type_desc,       
 9         IS_SRVROLEMEMBER('sysadmin', name)    AS    IsSysAdmin
10 FROM    sys.server_principals p
11 where name='sa'

 

posted @ 2013-08-03 23:21 桦仔 阅读(...) 评论(...)  编辑 收藏