Monday, March 26, 2012

how to change permission via t-sql

Hello,
I have a database that has about 50 tables. I have a user group assigned
to the database. I want them to be able to insert/update but not delete. The
only way I have seen is to go into the table permissions and change the
permissions. Is there an easier way via t-sql? Thanks in advance.
JakeRun this, verify that the output will do what you want and then execute the
output:
SELECT 'GRANT INSERT, UPDATE ON ' + TABLE_NAME + ' TO YourUserGroup' FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'base table'
--
Keith
"Jake" <rondican@.hotmail.com> wrote in message
news:uyD6ueAoEHA.1456@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I have a database that has about 50 tables. I have a user group
assigned
> to the database. I want them to be able to insert/update but not delete.
The
> only way I have seen is to go into the table permissions and change the
> permissions. Is there an easier way via t-sql? Thanks in advance.
> Jake
>|||Keith,
Thanks very much for the info
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message
news:efMdMqAoEHA.2588@.TK2MSFTNGP12.phx.gbl...
> Run this, verify that the output will do what you want and then execute
the
> output:
> SELECT 'GRANT INSERT, UPDATE ON ' + TABLE_NAME + ' TO YourUserGroup' FROM
> INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'base table'
> --
> Keith
>
> "Jake" <rondican@.hotmail.com> wrote in message
> news:uyD6ueAoEHA.1456@.TK2MSFTNGP10.phx.gbl...
> > Hello,
> >
> > I have a database that has about 50 tables. I have a user group
> assigned
> > to the database. I want them to be able to insert/update but not delete.
> The
> > only way I have seen is to go into the table permissions and change the
> > permissions. Is there an easier way via t-sql? Thanks in advance.
> >
> > Jake
> >
> >
>

No comments:

Post a Comment