Lefteris Gkinis
Lefteris Gkinis

Reputation: 1259

Roles in SQL 2008 R2

When I’m trying to create a role then I receive the error “role exists” and I have to deleted first and repeat the process.

Upvotes: 2

Views: 171

Answers (1)

roman
roman

Reputation: 117337

use sys.database_principals view:

select * from sys.database_principals where name = @Role_Name and type = 'R'

it's also possible to use database_principal_id:

select database_principal_id(@Role_Name)

Upvotes: 1

Related Questions