Tuesday, March 27, 2012

Adds the group to the database But Security EM

I am trying to add domain group with sql server security privileges to a SQL
Server database.
I view the database with SQL Server Enterprise Manager in the database and
users
and notice that domain group is add (sp_addgroup) but this not applied to
the SQL Server security domain group.
Not using the SQL Server Enterprise Manager. How do get the domain group
with
privileges applied to both places (database user , security).> I view the database with SQL Server Enterprise Manager in the database and
> users
> and notice that domain group is add (sp_addgroup) but this not applied to
> the SQL Server security domain group.
sp_addgroup adds a new database role. It is not used to grant an existing
Windows group database access. Also, sp_addgroup is provided only for
backwards compatibility. Use sp_addrole instead.

> Not using the SQL Server Enterprise Manager. How do get the domain group
> with
> privileges applied to both places (database user , security).
From Query Analyzer:
USE MyDatabase
--grant group permissions to connect to SQL Server
EXEC sp_grantlogin 'MyDomain\MyGroup'
--grant group permissions to use this database
EXEC sp_grantdbaccess 'MyDomain\MyGroup'
To setup object security, you can either grant permissions directly to the
Windows account or grant permissions to a SQL Server role and control
security via role membership
--grant object permissions directly
GRANT SELECT ON MyTable TO [MyDomain\MyGroup]
--grant object permissions to role
GRANT SELECT ON MyTable TO [MyDatabaseRole]
--add group to role
EXEC sp_addrolemember 'MyDatabaseRole', 'MyDomain\MyGroup'
Hope this helps.
Dan Guzman
SQL Server MVP
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:229E0AAA-AEED-400D-B082-3425919A0F85@.microsoft.com...
>I am trying to add domain group with sql server security privileges to a
>SQL
> Server database.
> I view the database with SQL Server Enterprise Manager in the database and
> users
> and notice that domain group is add (sp_addgroup) but this not applied to
> the SQL Server security domain group.
> Not using the SQL Server Enterprise Manager. How do get the domain group
> with
> privileges applied to both places (database user , security).
>
>

No comments:

Post a Comment