This is a quick way to find out what roles a user has on the SQL Server
Just change the value of @chvLoginName to the login you want
DECLARE @chvLoginName VARCHAR(50)
SELECT @chvLoginName='BUILTIN\Administrators'
SELECT [name],sysadmin,securityadmin,serveradmin,
setupadmin,processadmin,diskadmin,
dbcreator,bulkadmin,loginname
FROM master..syslogins
WHERE loginname =@chvLoginName
-------------------------------------------------------------------------------
The query below returns all logins whose role is a certain role.
The available roles are:
sysadmin
Can perform any activity in SQL Server.
serveradmin
Can set serverwide configuration options, shut down the server.
setupadmin
Can manage linked servers and startup procedures.
securityadmin
Can manage logins and CREATE DATABASE permissions, also read error logs and change passwords.
processadmin
Can manage processes running in SQL Server.
dbcreator
Can create, alter, and drop databases.
diskadmin
Can manage disk files.
bulkadmin
Can execute BULK INSERT statements.
SELECT [name],sysadmin,bulkadmin
FROM master..syslogins
WHERE sysadmin =1 or bulkadmin =1
1 comment:
Hi, could you please leave your msn to me, I want to ask you a question. thanks
Post a Comment