Check if current logon is the database owner – SQL Server 2000 – 2005 – 2008 - 2012 - is_member

05 March,2013 by Jack Vamvas

Sometimes I need to know if I’m the database owner with the current logon. A typical situation  is executing DML statements . In those situations I may need to check if the logon is the database owner for certain elevated rights.

The IS_MEMBER function meets the requirements.  The function checks if the current user is a  member of the group or role requested .

 

--Example1 - 
SELECT IS_MEMBER('db_owner')

--Example 2

IF IS_MEMBER ('db_owner') = 1
   PRINT 'I am a member of the db_owner role'
ELSE
   PRINT 'I am not member of the db_owner role'

 

Read More

MULTI – RESTRICTED USER - SQL Server DBA

Find sql database users and Find - SQL Server DBA

Security Risk Analysis and database security - SQL Server DBA


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Check if current logon is the database owner – SQL Server 2000 – 2005 – 2008 - 2012 - is_member


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer