Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set permissions using variables

Status
Not open for further replies.

katehol

Technical User
May 2, 2007
57
GB
Is there any way that I can set up permissions on SQL Server 2005 with the use of variables. I am looking to do something like this...

Code:
DECLARE @Login varchar(255)

SET @Login = 'LoginName'

GRANT CONNECT TO QUOTENAME(@Login)
                         --(ie GRANT CONNECT TO [LoginName])

As I have a very long list of permissions, it would save me having to change the login name for each permission.

Any help would be much appreciated.

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top