sql - Check if role exists in DB? -


I want to add users to the same role in multiple databases. Although the role can not be present in all the databases, how can I check whether the role is present in the database and if it connects users in that role?

For example, if the role exists, add the user to the role AD

Try:

  If DATABASE_PRINCIPAL_ID ('role') is started tap - Add user here Create role role authorization MyUser; END  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -