Friday, March 23, 2012

problem in adding user and permission

Hi all
I want to create a sp which will from
Master database add user and give permission to that user to any
specified database using t-sql code.
How can I do it?
Thanks
AmHi
sp_addrole and GRANT operate against the current DB, so you can not be in
master and perform those operations against a user DB.
Look at "permissions-SQL Server" in BOL.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"AM" <anonymous@.examnotes.net> wrote in message
news:e%23G6glwXFHA.2128@.TK2MSFTNGP14.phx.gbl...
> Hi all
> I want to create a sp which will from
> Master database add user and give permission to that user to any
> specified database using t-sql code.
> How can I do it?
>
> --
> Thanks
> Am
>

No comments:

Post a Comment