Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Check SQL server role

Author  Topic 

cshong
Starting Member

8 Posts

Posted - 2010-03-16 : 11:40:35
What are the SQL query script for a user, who has logged in into the database (SQL server 2005), to check whether his user account is the member of the server role 'sysadmin', or any other server role?

I ask this question because I am developing a C++ program which will let user to login to the database by enter user name and password in the program. One of the feature of my c++ program is to verify whether the user is the administrator of the database, and let the user to do some tasks if he/she is the administrator of the database. The program will use ODBC to connect to the database.

And, I hope that the given SQL query script can be run by every database user, including those who are not the administrator of the database.

So, any reply will be appreciated.

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-03-16 : 13:26:52
exec sp_helpuser 'dbo'

=======================================
There are no passengers on spaceship earth. We are all crew. -Marshall McLuhan, educator and philosopher (1911-1980)
Go to Top of Page
   

- Advertisement -