Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Granting Privileges with a Script

Author  Topic 

foxprorawks
Starting Member

17 Posts

Posted - 2005-09-14 : 07:05:27
Hi,

I'm trying to write a script to grant privileges to a user (we are trying to allow Windows Authentication in our application).

Previously, we used the following syntax:

grant select, insert, delete, update on area to mattuser

Where mattuser is a valid sql server user.

However, we want to do something like the following:

grant select, insert, delete, update on area to MATT2000\IUSR_MATT2000

Where IUSR_MATT2000 is a valid user on computer MATT2000.

We get an error when we try to run this script as follows:

Incorrect syntax near '\'

How do we grant permissions for this user, other than doing it manually?

Regards.

Matt.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-14 : 07:08:45
Use square braces
grant select, insert, delete, update on area to [MATT2000\IUSR_MATT2000]



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

foxprorawks
Starting Member

17 Posts

Posted - 2005-09-14 : 07:12:29
That's excellent - thanks very much.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-14 : 07:19:29
Whenver you have special characters like /,\,- in the name, better to use them inside squre braces

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -