Showing posts with label grant. Show all posts
Showing posts with label grant. Show all posts

Thursday, March 29, 2012

Granting UPDATE for only certain columns in a table

I have tried using the SQL statement shown below to grant UPDATE permissions for a single column in a single table to a user with db_datareader privileges.

grant update (col_1) on trs.dbo.table_1 to calc

When I then run a SQL script that has an UPDATE for col_1 on trs.dbo.table_1, I get an error message

Msg 230, Level 14, State 1, Line 2100

UPDATE permission denied on column 'col_2' of object 'table_1', database 'TRS', schema 'dbo'.

Why is the error message referring to "col_2" when my SQL statement is trying to update "col_1"?

When I performed the "grant" I did it with an account that has db_owner, db_securityadmin, and db_ddladmin privileges.

This worked in SQL Server 2000. What must I do to get it to work in SQL Server 2005?

Sorry Dan - can you show us the update query?|||

You are going to have to dig deeper. The only scenario that I can think of where an update to another column causes an update to another column causing issues like this is with a trigger with dynamic SQL (a real no-no in almost all cases, but it could exist). The fact that you have appended database names to the ddl makes me curious as to how that *might* cause issue, but I don't even see how anything cross-database could be an issue either.

Here is a script that shows what I am meaning:

create table test
(
column1 int,
column2 int
)
go
create user fred without login
go
execute as user = 'fred'
go
update test
set column1 = 1
/*
Msg 229, Level 14, State 5, Line 1
The UPDATE permission was denied on the object 'test', database 'tempdb', schema 'dbo'.
*/
go
revert
go
grant update (column1) on test to fred
go
execute as user = 'fred'
go
update test
set column1 = 1
/*
(0 row(s) affected)
*/
update test
set column2 = 1
/*
Msg 230, Level 14, State 1, Line 1
The UPDATE permission was denied on the column 'column2' of the object 'test', database 'tempdb', schema 'dbo'.
*/
go
revert
go
create trigger test$updateColumn1
on test
after update
as
begin
exec('
update test
set column2 = 2')
end
go
execute as user = 'fred'
go
update test
set column1 = 1
/*
Msg 230, Level 14, State 1, Line 2
The UPDATE permission was denied on the column 'column2' of the object 'test', database 'tempdb', schema 'dbo'.
*/

If you could post a full example like this showing your issue I think that you might find your error, or certainly one of us can help you out.

|||

Thanks for your support.

Here is a small bit of code that is able to produce the problem. It seems to be associated with having a JOIN in the UPDATE statement. An UPDATE without the JOIN works just fine.

Using a DB_OWNER account perform the following table creation, insert, and grant commands:

create table trs.dbo.people
(
name varchar(10),
sex varchar(10),
age smallint
)

insert into people values ('tom', 'male', 10)
insert into people values ('jane', 'female', 18)
insert into people values ('sue', 'female', 22)

create table trs.dbo.grads
(
name varchar(10),
grad_yr varchar(4)
)

insert into grads values ('jane', '2006')
insert into grads values ('sue', '2002')

grant update (age) on trs.dbo.people to calc

Then, from the db_datareader account, calc, run the following UPDATE statements, one at a time.

update p
set age = 40
from trs.dbo.people p
where (age is not null)
;

update p
set age = 35
from trs.dbo.people p
inner join trs.dbo.grads g
on p.name = g.name
where (age is not null)
;

The first one works. The second one fails with error message

Msg 230, Level 14, State 1, Line 1

UPDATE permission denied on column 'name' of object 'people', database 'TRS', schema 'dbo'.

Does this help?

|||Very nice. I have no answer as to why this is, but I will check around and let you know.|||Thanks!|||Do you have select permission on the other columns?

I know it's complaining that you don't have UPDATE permission... but it's complaining about your access to another column that's involved in the join.

Rob|||

Rob,

If I enter SELECT statements against the two tables, while connected as "CALC", all the rows from each table are returned.

select * from grads;

select * from people;

I have also tried using the DB_OWNER connection to explicity GRANT SELECT access to those tables, and still get the same error message when I try to update the AGE column, as in the example above, while connected as "CALC".

grant select on trs.dbo.people to calc
grant select (name) on trs.dbo.people to calc
grant select on trs.dbo.grads to calc

Dan

|||Ok, so that idea wasn't right. ;)

It's somehow related to the fact that you're joining the table you're updating to another table, and the engine thinks that it needs to be able to update that column too. It doesn't of course, but the fact that the column is used in the query must be confusing it somehow.

I assume this works just fine if you grant update access to the name column too?

One workaround might be to wrap it up in a table expression, but if that works, it'll just be down to luck.

Rob|||

The same code runs just fine with SQL Server 2000. I only ran into a problem when I tried moving it over to SQL Server 2005.

If I grant UPDATE access on the NAME column, as identified in the Error message, then the code runs.

But I hate to do that, since CALC is supposed to be a relatively "unprivileged" user, with db_datareader general privileges only, and CREATE TABLE privileges -- and in my actual application, these other columns are the PRIMARY KEY columns in the tables.

Adding a new column to the table, a column to which CALC has UPDATE permission, was a way of avoiding creating an entirely new table for CALC to own, with 500,000 rows, and a 20-byte primary key that incorporates 5 columns. Had I created such a new table my processing queries would have to JOIN this table to the 500,000 row counterpart. Instead of such a JOIN I added a new column as a simpler, faster solution.

Dan

|||Hmm... I'll have to do some more hunting. I'd like to say "try using a cte or view", or something like that (based on the fact that you might be able to update a view without it thinking it needs to be able to update the joining column), but I actually don't know if that will help. I'll have to recreate the situation locally and try some things.

But hopefully some of the other guys will already know the answer to this.

Rob|||

This seems like such a "natural" thing to have to do, in most any application that requires user permissions to only certain columns in a table.

Consider a table that connects salary to social security number. If you want to allow someone to edit SALARY, must you also allow them to edit SOCIAL SECURITY NUMBER?

What if you are running a medical office and have some sort of PATIENT NUMBER in the medical records. If you want to edit information on their account, such as their ZIP CODE, must you also allow them to edit the PATIENT NUMBER?

Is there maybe a greater need in SQL Server 2005 to create a new ROLE for every different set of permissions that one might need in the database, rather than use GRANT UPDATE to customize access to different users?

I'm not now at my office where I could try it, but I'm wondering if some SYSTEM table stores UPDATE permissions, and if a user has NOT received GRANT or DENY UPDATE permissions on a column in a table, maybe an INNER JOIN is being used, rather than an OUTER JOIN on the permissions table. If that is true, I suppose I can DENY UPDATE on the NAME column in the example, and the query should work, because it finds an entry in the permissions table for the NAME column, even though that entry is "DENY." So tomorrow at the office I'll try DENY UPDATE (name) on TRS.DBO.PEOPLE to CALC. (I'll have to check the syntax on the DENY statement. I think I noticed one in the past few days.)

Dan

|||

This is almost clearly a bug that I posted here: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=257897

A (not terribly satisfying) workaround is to move the join to a subquery:

update p set age = 35
from trs.dbo.people p
where p.name in (select p2.name
from trs.dbo.people p2
inner join trs.dbo.grads g
on p.name = g.name
where (age is not null))

Here is the simple repro with users I posted:

create database trs
go
use trs
go
create table trs.dbo.people
(
name varchar(10),
sex varchar(10),
age smallint
)

insert into people values ('tom', 'male', 10)
insert into people values ('jane', 'female', 18)
insert into people values ('sue', 'female', 22)

create table trs.dbo.grads
(
name varchar(10),
grad_yr varchar(4)
)

insert into grads values ('jane', '2006')
insert into grads values ('sue', '2002')
go
create user calc without login
sp_addrolemember 'db_datareader','calc'
go
grant update (age) on trs.dbo.people to calc
go

--Then, from the db_datareader account, calc, run the following UPDATE
statements, one at a time.
execute as user = 'calc'
go

update p
set age = 40
from trs.dbo.people p
where (age is not null)
;

update p
set age = 35
from trs.dbo.people p
inner join trs.dbo.grads g
on p.name = g.name
where (age is not null)
;

/*
Msg 230, Level 14, State 1, Line 1
The UPDATE permission was denied on the column 'name' of the object
'people', database 'trs', schema 'dbo'.
*/
--

|||

Louis,

Thanks for posting that to the MS "feedback" site.

I tried my "DENY UPDATE" idea, but it didn't fix anything: the same error message was obtained for the same UPDATE statement.

There aren't many places in my code where I am performing updates on columns where the GRANT UPDATE permission is limited to certain columns -- maybe a few dozen. I'll just make the code edits corresponding to your suggestion, and maybe un-do them if/when a patch occurs.

Thanks again.

Dan

|||

Louis,

I reworked my code for SQL Server 2005, using the technique you suggested (or something quite similar):

update p set age = 35
from trs.dbo.people p
where p.name in (select p2.name
from trs.dbo.people p2
inner join trs.dbo.grads g
on p.name = g.name
where (age is not null))

In all but a single instance, this solution worked just fine.

In the remaining instance, the value that I need for the SET clause is from the JOINed table. Were we using the example I supplied (rather than my actual code), this could appear as

update p
set age = cast(g.grad_yr as int) + 18 - 2006
from trs.dbo.people p
inner join trs.dbo.grads g
on p.name = g.name
where (age is not null)

I didn't see any easy way around this, other than to create a CURSOR on "select distinct GRAD_YR from GRADS" and using a LOOP over the CURSOR values, and having code like

update p
set age = @.grad_yr + 18 - 2006
from trs.dbo.people p
where (age is not null) and p.name in (select distinct name from trs.dbo.grads where grad_yr = @.grad_yr)

I am thankful that the number of values for my CURSOR is less than 10, in my actual application.

If you can think of a better alternative, I would be happy to learn of it.

Thanks.

Dan

Granting Select to an NT Login Group

I have this procdure to grant select permission to a developers group on an
SQL Databse. The query executes but never returnes and the permissions are
set. Can anyone tell me why the little world keeps spinning and never
returns. thanks
DECLARE @.cmd as varchar(255)
DECLARE table_names CURSOR FOR
SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
DECLARE @.name as varchar(255)
OPEN table_names
FETCH NEXT FROM table_names INTO @.name
WHILE (@.@.FETCH_STATUS <> 1)
SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
--PRINT @.cmd
EXEC @.cmd
FETCH NEXT FROM table_names INTO @.name
DEALLOCATE table_names
CLOSE table_names
"brymer28303" <brymer28303@.discussions.microsoft.com> wrote in message
news:D3BA7C42-13A0-49EF-A476-3A32121E2D41@.microsoft.com...
>I have this procdure to grant select permission to a developers group on an
> SQL Databse. The query executes but never returnes and the permissions
> are
> set. Can anyone tell me why the little world keeps spinning and never
> returns. thanks
> DECLARE @.cmd as varchar(255)
> DECLARE table_names CURSOR FOR
> SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
> DECLARE @.name as varchar(255)
> OPEN table_names
> FETCH NEXT FROM table_names INTO @.name
> WHILE (@.@.FETCH_STATUS <> 1)
> SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
> --PRINT @.cmd
> EXEC @.cmd
> FETCH NEXT FROM table_names INTO @.name
> DEALLOCATE table_names
> CLOSE table_names
Infinite loop. Your loop doesn't include the FETCH NEXT. Also you should
test for @.@.FETCH_STATUS = 0, since values other that 1 are possible.
Should beL
DECLARE @.cmd as varchar(255)
DECLARE table_names CURSOR FOR
SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
DECLARE @.name as varchar(255)
OPEN table_names
FETCH NEXT FROM table_names INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
--PRINT @.cmd
EXEC @.cmd
FETCH NEXT FROM table_names INTO @.name
END
CLOSE table_names
DEALLOCATE table_names
David
|||Thanks David
"David Browne" wrote:

>
> "brymer28303" <brymer28303@.discussions.microsoft.com> wrote in message
> news:D3BA7C42-13A0-49EF-A476-3A32121E2D41@.microsoft.com...
> Infinite loop. Your loop doesn't include the FETCH NEXT. Also you should
> test for @.@.FETCH_STATUS = 0, since values other that 1 are possible.
> Should beL
> DECLARE @.cmd as varchar(255)
> DECLARE table_names CURSOR FOR
> SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
> DECLARE @.name as varchar(255)
> OPEN table_names
> FETCH NEXT FROM table_names INTO @.name
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
> --PRINT @.cmd
> EXEC @.cmd
> FETCH NEXT FROM table_names INTO @.name
> END
> CLOSE table_names
> DEALLOCATE table_names
>
> David
>

Granting Select to an NT Login Group

I have this procdure to grant select permission to a developers group on an
SQL Databse. The query executes but never returnes and the permissions are
set. Can anyone tell me why the little world keeps spinning and never
returns. thanks
DECLARE @.cmd as varchar(255)
DECLARE table_names CURSOR FOR
SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
DECLARE @.name as varchar(255)
OPEN table_names
FETCH NEXT FROM table_names INTO @.name
WHILE (@.@.FETCH_STATUS <> 1)
SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
--PRINT @.cmd
EXEC @.cmd
FETCH NEXT FROM table_names INTO @.name
DEALLOCATE table_names
CLOSE table_names"brymer28303" <brymer28303@.discussions.microsoft.com> wrote in message
news:D3BA7C42-13A0-49EF-A476-3A32121E2D41@.microsoft.com...
>I have this procdure to grant select permission to a developers group on an
> SQL Databse. The query executes but never returnes and the permissions
> are
> set. Can anyone tell me why the little world keeps spinning and never
> returns. thanks
> DECLARE @.cmd as varchar(255)
> DECLARE table_names CURSOR FOR
> SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
> DECLARE @.name as varchar(255)
> OPEN table_names
> FETCH NEXT FROM table_names INTO @.name
> WHILE (@.@.FETCH_STATUS <> 1)
> SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
> --PRINT @.cmd
> EXEC @.cmd
> FETCH NEXT FROM table_names INTO @.name
> DEALLOCATE table_names
> CLOSE table_names
Infinite loop. Your loop doesn't include the FETCH NEXT. Also you should
test for @.@.FETCH_STATUS = 0, since values other that 1 are possible.
Should beL
DECLARE @.cmd as varchar(255)
DECLARE table_names CURSOR FOR
SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
DECLARE @.name as varchar(255)
OPEN table_names
FETCH NEXT FROM table_names INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
--PRINT @.cmd
EXEC @.cmd
FETCH NEXT FROM table_names INTO @.name
END
CLOSE table_names
DEALLOCATE table_names
David|||Thanks David
"David Browne" wrote:

>
> "brymer28303" <brymer28303@.discussions.microsoft.com> wrote in message
> news:D3BA7C42-13A0-49EF-A476-3A32121E2D41@.microsoft.com...
> Infinite loop. Your loop doesn't include the FETCH NEXT. Also you should
> test for @.@.FETCH_STATUS = 0, since values other that 1 are possible.
> Should beL
> DECLARE @.cmd as varchar(255)
> DECLARE table_names CURSOR FOR
> SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
> DECLARE @.name as varchar(255)
> OPEN table_names
> FETCH NEXT FROM table_names INTO @.name
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
> --PRINT @.cmd
> EXEC @.cmd
> FETCH NEXT FROM table_names INTO @.name
> END
> CLOSE table_names
> DEALLOCATE table_names
>
> David
>

Granting Select to an NT Login Group

I have this procdure to grant select permission to a developers group on an
SQL Databse. The query executes but never returnes and the permissions are
set. Can anyone tell me why the little world keeps spinning and never
returns. thanks
DECLARE @.cmd as varchar(255)
DECLARE table_names CURSOR FOR
SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
DECLARE @.name as varchar(255)
OPEN table_names
FETCH NEXT FROM table_names INTO @.name
WHILE (@.@.FETCH_STATUS <> 1)
SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
--PRINT @.cmd
EXEC @.cmd
FETCH NEXT FROM table_names INTO @.name
DEALLOCATE table_names
CLOSE table_names"brymer28303" <brymer28303@.discussions.microsoft.com> wrote in message
news:D3BA7C42-13A0-49EF-A476-3A32121E2D41@.microsoft.com...
>I have this procdure to grant select permission to a developers group on an
> SQL Databse. The query executes but never returnes and the permissions
> are
> set. Can anyone tell me why the little world keeps spinning and never
> returns. thanks
> DECLARE @.cmd as varchar(255)
> DECLARE table_names CURSOR FOR
> SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
> DECLARE @.name as varchar(255)
> OPEN table_names
> FETCH NEXT FROM table_names INTO @.name
> WHILE (@.@.FETCH_STATUS <> 1)
> SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
> --PRINT @.cmd
> EXEC @.cmd
> FETCH NEXT FROM table_names INTO @.name
> DEALLOCATE table_names
> CLOSE table_names
Infinite loop. Your loop doesn't include the FETCH NEXT. Also you should
test for @.@.FETCH_STATUS = 0, since values other that 1 are possible.
Should beL
DECLARE @.cmd as varchar(255)
DECLARE table_names CURSOR FOR
SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
DECLARE @.name as varchar(255)
OPEN table_names
FETCH NEXT FROM table_names INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
--PRINT @.cmd
EXEC @.cmd
FETCH NEXT FROM table_names INTO @.name
END
CLOSE table_names
DEALLOCATE table_names
David|||Thanks David
"David Browne" wrote:
>
> "brymer28303" <brymer28303@.discussions.microsoft.com> wrote in message
> news:D3BA7C42-13A0-49EF-A476-3A32121E2D41@.microsoft.com...
> >I have this procdure to grant select permission to a developers group on an
> > SQL Databse. The query executes but never returnes and the permissions
> > are
> > set. Can anyone tell me why the little world keeps spinning and never
> > returns. thanks
> >
> > DECLARE @.cmd as varchar(255)
> >
> > DECLARE table_names CURSOR FOR
> > SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
> > DECLARE @.name as varchar(255)
> >
> > OPEN table_names
> > FETCH NEXT FROM table_names INTO @.name
> > WHILE (@.@.FETCH_STATUS <> 1)
> > SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
> > --PRINT @.cmd
> > EXEC @.cmd
> > FETCH NEXT FROM table_names INTO @.name
> > DEALLOCATE table_names
> > CLOSE table_names
> Infinite loop. Your loop doesn't include the FETCH NEXT. Also you should
> test for @.@.FETCH_STATUS = 0, since values other that 1 are possible.
> Should beL
> DECLARE @.cmd as varchar(255)
> DECLARE table_names CURSOR FOR
> SELECT [name] FROM sysobjects WHERE type = 'u' ORDER BY [name]
> DECLARE @.name as varchar(255)
> OPEN table_names
> FETCH NEXT FROM table_names INTO @.name
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> SELECT @.cmd = 'GRANT SELECT ON ' + @.name + ' TO [VS Developers]'
> --PRINT @.cmd
> EXEC @.cmd
> FETCH NEXT FROM table_names INTO @.name
> END
> CLOSE table_names
> DEALLOCATE table_names
>
> David
>sql

granting select permission

Hi,

How to grant select permission on table of another database from current database.

Ex: I am in database asddb

I want to grant select permission on table "test" which is in database bsddb.

Can anyone please help me in resolving this problem.Please take a look at the GRANT statement in Books Online. You need to switch to the database using USE and run the GRANT statement.

granting select permission

Hi,

How to grant select permission on table of another database from current database.

Ex: I am in database asddb

I want to grant select permission on table "test" which is in database bsddb.

Can anyone please help me in resolving this problem.Please take a look at the GRANT statement in Books Online. You need to switch to the database using USE and run the GRANT statement.

granting public permissions to another role

We need to revoke all insert/update/delete access from public. So this won't
affect users I wanted to create a new role and grant it all of these excess
permissions from public, then revoke the permissions from public. It looks
like there are thousands of grants that need to be revoked - can anyone thin
k
of a way to script this?
Thank you in advance.One method is to generate the script using Transact-SQL. You can tweak the
example below to generate the desired script. This example script ignores
system objects and doesn't handle column permissions.
SET NOCOUNT ON
SELECT
CASE [p].[protecttype]
WHEN 204 THEN 'GRANT '
WHEN 205 THEN 'GRANT '
WHEN 206 THEN 'DENY '
END +
CASE [p].[action]
WHEN 193 THEN 'SELECT'
WHEN 195 THEN 'INSERT'
WHEN 196 THEN 'DELETE'
WHEN 197 THEN 'UPDATE'
WHEN 224 THEN 'EXECUTE'
WHEN 26 THEN 'REFERENCES'
END + ' ON ' +
QUOTENAME(USER_NAME([o].[uid])) + '.' +
QUOTENAME([o].[name]) + ' TO ' +
QUOTENAME([u].[name]) +
CASE WHEN [p].[protecttype] = 204 THEN ' WITH GRANT OPTION' ELSE '' END
FROM
[sysobjects] AS [o]
JOIN
[sysprotects] AS [p] ON
[p].[id] = [o].[id]
JOIN
[sysusers] AS [u] ON
[p].[uid] = [u].[uid]
WHERE
OBJECTPROPERTY([o].[id], 'IsMSShipped') = 0 AND
[u].[name] = 'public'
Hope this helps.
Dan Guzman
SQL Server MVP
"Bobsie" <Bobsie@.discussions.microsoft.com> wrote in message
news:745289F7-F2CF-4079-8A35-66974CFA73F3@.microsoft.com...
> We need to revoke all insert/update/delete access from public. So this
> won't
> affect users I wanted to create a new role and grant it all of these
> excess
> permissions from public, then revoke the permissions from public. It looks
> like there are thousands of grants that need to be revoked - can anyone
> think
> of a way to script this?
> Thank you in advance.|||Thanks for the help - and when it comes to revoking the permissions from
"public" I could use a similar script using "revoke" instead of "grant"?
"Dan Guzman" wrote:

> One method is to generate the script using Transact-SQL. You can tweak th
e
> example below to generate the desired script. This example script ignores
> system objects and doesn't handle column permissions.
> SET NOCOUNT ON
> SELECT
> CASE [p].[protecttype]
> WHEN 204 THEN 'GRANT '
> WHEN 205 THEN 'GRANT '
> WHEN 206 THEN 'DENY '
> END +
> CASE [p].[action]
> WHEN 193 THEN 'SELECT'
> WHEN 195 THEN 'INSERT'
> WHEN 196 THEN 'DELETE'
> WHEN 197 THEN 'UPDATE'
> WHEN 224 THEN 'EXECUTE'
> WHEN 26 THEN 'REFERENCES'
> END + ' ON ' +
> QUOTENAME(USER_NAME([o].[uid])) + '.' +
> QUOTENAME([o].[name]) + ' TO ' +
> QUOTENAME([u].[name]) +
> CASE WHEN [p].[protecttype] = 204 THEN ' WITH GRANT OPTION' ELSE '' END
> FROM
> [sysobjects] AS [o]
> JOIN
> [sysprotects] AS [p] ON
> [p].[id] = [o].[id]
> JOIN
> [sysusers] AS [u] ON
> [p].[uid] = [u].[uid]
> WHERE
> OBJECTPROPERTY([o].[id], 'IsMSShipped') = 0 AND
> [u].[name] = 'public'
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Bobsie" <Bobsie@.discussions.microsoft.com> wrote in message
> news:745289F7-F2CF-4079-8A35-66974CFA73F3@.microsoft.com...
>
>|||Yes, Bobsie, the script I posted was developed to script existing
permissions. You'll need to modify it so that modified permission scripts
are generated instead.
Run the script once to extract the public permissions with your new role
hard-coded as the grantee instead of public'. The generated script will
looks something like:
GRANT SELECT ON MyTable TO MyNewRole
GRANT EXECUTE ON MyProc TO MyNewRole
Then run the script again with a hard-coded REVOKE instead of the GRANT/DENY
CASE statement so the second script generated will be like:
REVOKE SELECT ON MyTable TO public
REVOKE EXECUTE ON MyProc TO public
Be sure to review the generated scripts before running in your environment.
Hope this helps.
Dan Guzman
SQL Server MVP
"Bobsie" <Bobsie@.discussions.microsoft.com> wrote in message
news:3949EB00-7D35-4EC1-9920-249ABF69BBEC@.microsoft.com...
> Thanks for the help - and when it comes to revoking the permissions from
> "public" I could use a similar script using "revoke" instead of "grant"?
>
> "Dan Guzman" wrote:
>sql

granting privilages similar to existing user

I need to grant privilages to a user that are like the privilages of an
existing user. How can I do this?
chuck t.The easiest way would be to write a little SQL-DMO script. Create a user
object and then execute the ListObjectPermissions method. Alternatively,
you can use the Script method and replace the old user with the new user.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada tom@.cips.ca
www.pinpub.com
"Chuck" <Chuck@.discussions.microsoft.com> wrote in message
news:335EB4BA-1BCF-4151-9446-5D4BCA569657@.microsoft.com...
>I need to grant privilages to a user that are like the privilages of an
> existing user. How can I do this?
> --
> chuck t.|||Hi,
please check this if it help you to get list :
http://www.sql-server-performance.c...?TOPIC_ID=10504
:-)
Regards
--
Andy Davis
Activecrypt Team
---
SQL Server Encryption Software
http://www.activecrypt.com
"Chuck" wrote:

> I need to grant privilages to a user that are like the privilages of an
> existing user. How can I do this?
> --
> chuck t.

Granting Permissions using SQL 2005 Schema...

All,

I have been asked to grant a Windows group Full access to all tables under our Sandbox Schema. This will allow these users to do anything to the tables under this Schema.

I created the Windows Group (Sandbox Users), created the login in SQL, created the user in the database that is tied to the Windows group, then ran GRANT CONTROL ON SCHEMA::[Sandbox] TO [Sandbox Users].

I have verified that the users are in the Windows group, but they state that they still can not delete tables under the Sandbox Schema.

Anyone have any ideas?

Thanks,

Justin

They would need alter schema to drop tables in the schema.

GRANT ALTER ON SCHEMA::[Sandbox] TO [Sandbox Users]

-Sue

|||

CONTROL should cover ALTER and DELETE. My guess is that the users from that group have been denied some permission that is affecting their DELET statements.

You can make use of fn_my_permissions and has_perm_by_name to find out the actual permissions on the object, for example:

-- Connected as/impersonating a member of Sandbox users

--

SELECT * FROM fn_my_permissions( 'Sandbox', 'schema' )

go

SELECT has_perms_by_name( 'Sandbox.SampleTable', 'object', 'DELETE' )

go

I hope this information helps,

-Raul Garcia

SDE/T

SQL Server Engine

|||

Thanks for catching that Raul...not even sure what I was thinking last night. Or not thinking at that moment.

-Sue

|||

Raul,

Thanks... that will help. I will be working with the user this morning to see if I can figure out why he is having this problem.

It looks like the permissions are fine. I was helping him out this morning and I think he has an issue with the package he was trying to run, bu the fn_my_permissions helped out tremendously.

Thanks!

Justin

Granting Permissions using SQL 2005 Schema...

All,

I have been asked to grant a Windows group Full access to all tables under our Sandbox Schema. This will allow these users to do anything to the tables under this Schema.

I created the Windows Group (Sandbox Users), created the login in SQL, created the user in the database that is tied to the Windows group, then ran GRANT CONTROL ON SCHEMA::[Sandbox] TO [Sandbox Users].

I have verified that the users are in the Windows group, but they state that they still can not delete tables under the Sandbox Schema.

Anyone have any ideas?

Thanks,

Justin

They would need alter schema to drop tables in the schema.

GRANT ALTER ON SCHEMA::[Sandbox] TO [Sandbox Users]

-Sue

|||

CONTROL should cover ALTER and DELETE. My guess is that the users from that group have been denied some permission that is affecting their DELET statements.

You can make use of fn_my_permissions and has_perm_by_name to find out the actual permissions on the object, for example:

-- Connected as/impersonating a member of Sandbox users

--

SELECT * FROM fn_my_permissions( 'Sandbox', 'schema' )

go

SELECT has_perms_by_name( 'Sandbox.SampleTable', 'object', 'DELETE' )

go

I hope this information helps,

-Raul Garcia

SDE/T

SQL Server Engine

|||

Thanks for catching that Raul...not even sure what I was thinking last night. Or not thinking at that moment.

-Sue

|||

Raul,

Thanks... that will help. I will be working with the user this morning to see if I can figure out why he is having this problem.

It looks like the permissions are fine. I was helping him out this morning and I think he has an issue with the package he was trying to run, bu the fn_my_permissions helped out tremendously.

Thanks!

Justin

Granting permissions to xp_regread

Is it possible to grant execute permissions to xp_regread to a user who isn'
t
a member of the sysadmins role?Public has execute permissions on xp_regread so why would
you need to? But yes...you can grant execute.
-Sue
On Tue, 18 Oct 2005 20:28:02 -0700, "David"
<David@.discussions.microsoft.com> wrote:

>Is it possible to grant execute permissions to xp_regread to a user who isn
't
>a member of the sysadmins role?

Granting permissions to stored procedures

I am using the following code to grant user access to the stored procedures in my database. However, it does not appear to be working because I am getting an access denied message when running the application as the user.

Here is the code I am using:

Code Snippet

' Grant privileges

Dim ExecutePrivilege As New ObjectPermissionSet

ExecutePrivilege.Execute = True

' Grant privileges to all non-system stored procs

' The following line improves performance

SmoServer.SetDefaultInitFields(GetType(StoredProcedure), "IsSystemObject")

For Each sp As StoredProcedure In db.StoredProcedures

If Not sp.IsSystemObject Then

sp.Grant(ExecutePrivilege, loginName)

End If

Next

Is there something else I need to do, like a Save or Refresh or something? (I've stepped through the code and it *is* executing for each of my stored procedures. It just does not appear to actually have updated the priviledge.)

Any tips or ideas would be appreciated.

Thanks!

Security related commands are always executed directly, unless you change the setting from the context to only script the commands like the following statement does:

svr.ConnectionContext.SqlExecutionModes = SqlExecutionModes.CaptureSql;

The reflected sources show that a property is set for this which is called


so.ForDirectExecution = true;

Did you have a look in the profiler to see if the commands are arriving at the server and are eventually bounced back due to errors occuring during applying the script ?

Jens K. Suessmeyer

http://www.sqlserver2005.de|||

I skipped the profiler and went right to the database. I can view permissions, and they are actually set correctly. So the code is executing. (Should have thought of that before I posted!<G>)

The problem is that when I try to access any of the stored procs (or the tables), I get a "permission was denied on the object" message. So something else is obviously wrong.

This particular code happens to be in VB6, accessing SQLServer Express. When the *same* code accesses a SQL Server 2000 database, it runs without this error.

Any idea what could be wrong here? Or at this point do I need to move the question elsewhere since it does not appear to be an SMO problem.

sql

Granting permissions

How can I do
create proc MyProc
as
--...proc logic
go
grant execute on MyProc to MYCOMPUTER\ASPNET
I can do the 'grant' statement where the user name doesn't include a
computer prefix - but the ASPNET account does! It keeps complaining, citing
'Incorrect syntax near \'.
The following doesn't work either.
grant execute on MyProc to 'MYCOMPUTER\ASPNET'
Any suggestions?Bonj,
I think MYCOMPUTER\ASPNET is the login name, What is the user name
associated to this login in your db?
AMB
"Bonj" wrote:

> How can I do
> create proc MyProc
> as
> --...proc logic
> go
> grant execute on MyProc to MYCOMPUTER\ASPNET
> I can do the 'grant' statement where the user name doesn't include a
> computer prefix - but the ASPNET account does! It keeps complaining, citin
g
> 'Incorrect syntax near '.
> The following doesn't work either.
> grant execute on MyProc to 'MYCOMPUTER\ASPNET'
>
> Any suggestions?|||assuming MYCOMPUTER\ASPNET is a defined login, then:
grant execute on MyProc to "MYCOMPUTER\\ASPNET"
note double quotes
"Bonj" <Bonj@.discussions.microsoft.com> wrote in message
news:C4F7742C-22E5-4FEB-BE1B-3570FC0645B0@.microsoft.com...
| How can I do
|
| create proc MyProc
| as
| --...proc logic
| go
| grant execute on MyProc to MYCOMPUTER\ASPNET
|
| I can do the 'grant' statement where the user name doesn't include a
| computer prefix - but the ASPNET account does! It keeps complaining,
citing
| 'Incorrect syntax near \'.
| The following doesn't work either.
| grant execute on MyProc to 'MYCOMPUTER\ASPNET'
|
|
| Any suggestions?sql

granting permission to create view

What is the best way to grant a user permission to create a view?

I first created a role using enterprise manager but for the role I
created it doesn't seem to offer that permission. It offers the basic
stuff such as insert, select, and update.

I could go in and use a grant create view sql statement I suppose but
I'd rather do it through enterprise manager where it would be visible
if I need to change it in the future.

-Davidwireless (wireless200@.yahoo.com) writes:
> What is the best way to grant a user permission to create a view?
> I first created a role using enterprise manager but for the role I
> created it doesn't seem to offer that permission. It offers the basic
> stuff such as insert, select, and update.
> I could go in and use a grant create view sql statement I suppose but
> I'd rather do it through enterprise manager where it would be visible
> if I need to change it in the future.

Enterprise Manager just reads the information off the database, and if
you say GRANT CREATE VIEW in Query Analyzer it should up in EM. The
permission does not look different because it was created from EM.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||On Tue, 24 Aug 2004 21:13:30 +0000 (UTC), Erland Sommarskog wrote:

> wireless (wireless200@.yahoo.com) writes:
>> What is the best way to grant a user permission to create a view?
>>
>> I first created a role using enterprise manager but for the role I
>> created it doesn't seem to offer that permission. It offers the basic
>> stuff such as insert, select, and update.
>>
>> I could go in and use a grant create view sql statement I suppose but
>> I'd rather do it through enterprise manager where it would be visible
>> if I need to change it in the future.
> Enterprise Manager just reads the information off the database, and if
> you say GRANT CREATE VIEW in Query Analyzer it should up in EM. The
> permission does not look different because it was created from EM.

It may not be obvious (I had to hunt for it) but the place to grant
statement permissions (to roles, users, or what have you) within Enterprise
Manager, is the Permissions tab of the Properties dialog for the database.|||Ross Presser <rpresser@.imtek.com> wrote in message news:<1xr5t5ei0r7jc.rs9lk0lr4jx1$.dlg@.40tude.net>...

> It may not be obvious (I had to hunt for it) but the place to grant
> statement permissions (to roles, users, or what have you) within Enterprise
> Manager, is the Permissions tab of the Properties dialog for the database.

That's right. I eventually found that. Thanks.

-David

granting permission

Want to grant permission for multiple tables to a user or role. is there a w
ay to do this with transact-SQL.
Please help!!!!!
Thanks.
A.SYes, look up GRANT in Books Online.
"J C" <anonymous@.discussions.microsoft.com> wrote in message
news:96B8B085-4A59-45B5-B2F6-1FF3336628FC@.microsoft.com...
> Want to grant permission for multiple tables to a user or role. is there a
way to do this with transact-SQL.
> Please help!!!!!
> Thanks.
> A.Ssql

Granting GRANT permissions

I have the need to allow users GRANT permissions for their created stored
procedures. However I do not wish to give these users db_securityadmin right
s
in the database they will be creating said stored procedures in.
Is there a way to only give them GRANT EXEC rights and nothing else? I
really don't like they idea they can modify groups and the users in those
groups with db_securityadmin rights as well as modify access rights to table
s.
Thanks
JoshCreators of stored procedures (standard users with CREATE PROCEDURE rights)
can grant permissions on their own procedures to other users. Is this what
you mean? i.e. if user A has CREATE PROCEDURE rights they can create a
procedure (A.P1) and then grant permissions on it to another user B (grant
exec on A.P1 to B). This is without them being in any other role than public
in the database.
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Josh N." <Josh N.@.discussions.microsoft.com> wrote in message
news:6BA4EBA0-9BC5-4A84-BBA8-A18502BFB93E@.microsoft.com...
>I have the need to allow users GRANT permissions for their created stored
> procedures. However I do not wish to give these users db_securityadmin
> rights
> in the database they will be creating said stored procedures in.
> Is there a way to only give them GRANT EXEC rights and nothing else? I
> really don't like they idea they can modify groups and the users in those
> groups with db_securityadmin rights as well as modify access rights to
> tables.
> Thanks
> Josh
>|||The owner of a stored procedure automatically has the ability to grant
others the right to execute it. They do not need to be in any special role.
HTH
Kalen Delaney
www.solidqualitylearning.com
"Josh N." <Josh N.@.discussions.microsoft.com> wrote in message
news:6BA4EBA0-9BC5-4A84-BBA8-A18502BFB93E@.microsoft.com...
>I have the need to allow users GRANT permissions for their created stored
> procedures. However I do not wish to give these users db_securityadmin
> rights
> in the database they will be creating said stored procedures in.
> Is there a way to only give them GRANT EXEC rights and nothing else? I
> really don't like they idea they can modify groups and the users in those
> groups with db_securityadmin rights as well as modify access rights to
> tables.
> Thanks
> Josh
>|||Yes this is what I was refering to. Thank you for your answer but I now
realize I have a much larger problem.
How do I allow a user to create a stored procedure for 'dbo' without giving
them owner rights? I tried to "grant create procedure to xxx as dbo" but
that errors out saying you can't use AS when granting those rights.
If anyone knows of a way to allow a user to create procedures and edit them
for dbo without being dbo I would appreciate your response.
Thanks
Josh
"Jasper Smith" wrote:

> Creators of stored procedures (standard users with CREATE PROCEDURE rights
)
> can grant permissions on their own procedures to other users. Is this what
> you mean? i.e. if user A has CREATE PROCEDURE rights they can create a
> procedure (A.P1) and then grant permissions on it to another user B (grant
> exec on A.P1 to B). This is without them being in any other role than publ
ic
> in the database.
> --
> HTH
> Jasper Smith (SQL Server MVP)
> http://www.sqldbatips.com
> I support PASS - the definitive, global
> community for SQL Server professionals -
> http://www.sqlpass.org
> "Josh N." <Josh N.@.discussions.microsoft.com> wrote in message
> news:6BA4EBA0-9BC5-4A84-BBA8-A18502BFB93E@.microsoft.com...
>
>|||Can you elaborate on exactly what you want to do? You can create a table
owned by dbo if you are in the db_owner role. In that case your user name is
not DBO, but you can act as the owner of the object.
There is no way to create a proc owned by dbo without being dbo or being in
the db_owner role.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Josh N." <JoshN@.discussions.microsoft.com> wrote in message
news:FCB0EC5B-B880-4B97-A82C-7EA14DF54096@.microsoft.com...
> Yes this is what I was refering to. Thank you for your answer but I now
> realize I have a much larger problem.
> How do I allow a user to create a stored procedure for 'dbo' without
> giving
> them owner rights? I tried to "grant create procedure to xxx as dbo" but
> that errors out saying you can't use AS when granting those rights.
> If anyone knows of a way to allow a user to create procedures and edit
> them
> for dbo without being dbo I would appreciate your response.
> Thanks
> Josh
>
>
> "Jasper Smith" wrote:
>
>|||I'm not really following what you mean either. I'm guessing
that you want a user to be able to create a stored procedure
that is owned by dbo without the user being a member of
db_owners. You can add the user to the db_ddladmin role and
they can create stored procedures owned by dbo. When they
create the stored procedures, they need to qualify them as
being owned by dbo...for example
create procedure dbo.SomeStoredProcedure <etc>
Members of db_ddladmin can also edit the stored procedures.
However, they inherit a lot of other permissions in the
process as they can add, modify, drop database objects, not
just stored procedures.
More info on exactly what you want to do would be good as it
is not necessarily a good thing to give these rights to
users.
-Sue
On Mon, 12 Sep 2005 13:45:02 -0700, "Josh N."
<JoshN@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Yes this is what I was refering to. Thank you for your answer but I now
>realize I have a much larger problem.
>How do I allow a user to create a stored procedure for 'dbo' without giving
>them owner rights? I tried to "grant create procedure to xxx as dbo" but
>that errors out saying you can't use AS when granting those rights.
>If anyone knows of a way to allow a user to create procedures and edit them
>for dbo without being dbo I would appreciate your response.
>Thanks
>Josh
>
>
>"Jasper Smith" wrote:
>|||Yes I want users who are not in db_owner or db_ddladmin to be able to create
procedures for dbo. But it appears my initial assumption about this is true,
which is unfortunate.
I appereciate everyone's responses and thank you. Unless anyone knows of a
way to allow users to do this without giving them db_ddladmin or db_owner, I
apparently am forced to leave a database wide open to people I don't trust
(this wasn't my decision...)
Josh
"Sue Hoegemeier" wrote:

> I'm not really following what you mean either. I'm guessing
> that you want a user to be able to create a stored procedure
> that is owned by dbo without the user being a member of
> db_owners. You can add the user to the db_ddladmin role and
> they can create stored procedures owned by dbo. When they
> create the stored procedures, they need to qualify them as
> being owned by dbo...for example
> create procedure dbo.SomeStoredProcedure <etc>
> Members of db_ddladmin can also edit the stored procedures.
> However, they inherit a lot of other permissions in the
> process as they can add, modify, drop database objects, not
> just stored procedures.
> More info on exactly what you want to do would be good as it
> is not necessarily a good thing to give these rights to
> users.
> -Sue
> On Mon, 12 Sep 2005 13:45:02 -0700, "Josh N."
> <JoshN@.discussions.microsoft.com> wrote:
>
>

Granting CREATE DATABASE rights

Can anyone give me some insight into how to grant CREATE
DATABASE rights to a user, but without him/her abled to
look at other objects.
For example, by granting this right, it seems this users
is abled to view all the logins etc within Enterprise
Managers (SQL7).
And wot would be the implications, since Access Xp
Projects required CREATE DATABASE rights in order to
create a new project? Is there another way?
Thks.
WayneDid you try
GRANT CREATE DATABASE TO loginname
Or giving the login the dbcreator role?
Note, however that this makes the login the owner of that database
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Wayne" <Wayne.Chan@.Bradford.NHS.UK> wrote in message
news:02ba01c3a901$5cda2ed0$a501280a@.phx.gbl...
> Can anyone give me some insight into how to grant CREATE
> DATABASE rights to a user, but without him/her abled to
> look at other objects.
> For example, by granting this right, it seems this users
> is abled to view all the logins etc within Enterprise
> Managers (SQL7).
> And wot would be the implications, since Access Xp
> Projects required CREATE DATABASE rights in order to
> create a new project? Is there another way?
> Thks.
> Waynesql

Granting consultant access to database

Hi,
I need to grant a consultant access to one database on an sql server.
I do not want to give him remote access to the server.
I have installed the client tools (Enterprise manager) on his laptop.
I put him in Users and made him db_admin.
However, when he connects to the server and clicks on the tables it says he
is an invalid user error 916.
Any ideas how i can do this so its most secure. He needs to examine the
tables on the server. The SQL server is 2000.
ThanksRoberto,
Something that you might check. If you ran sp_grantdbaccess to make your
consultant a user in the database, that does not prove that he has access to
the server. You may also need to:
EXEC sp_grantlogin 'Corporate\BobTheConsultant'
If that is OK, then you should also check that the default database of his
login is a database to which he has access. The 'not a user' may come from
the default database.
RLF
"Roberto R" <RobertoR@.discussions.microsoft.com> wrote in message
news:BE654755-B958-48AB-9B5A-BCF215916729@.microsoft.com...
> Hi,
> I need to grant a consultant access to one database on an sql server.
> I do not want to give him remote access to the server.
> I have installed the client tools (Enterprise manager) on his laptop.
> I put him in Users and made him db_admin.
> However, when he connects to the server and clicks on the tables it says
> he
> is an invalid user error 916.
> Any ideas how i can do this so its most secure. He needs to examine the
> tables on the server. The SQL server is 2000.
> Thanks

Granting Access to Modify jobs

How do you grant a user access to modify SQL Server jobs without granting
them full access to the Server. I want them to have access to certain
databases and also have the ability to modiy/create jobs.On Feb 14, 1:47 pm, Don <D...@.discussions.microsoft.com> wrote:
> How do you grant a user access to modify SQL Server jobs without granting
> them full access to the Server. I want them to have access to certain
> databases and also have the ability to modiy/create jobs.
They will have to be a Login on the Server, a User in each database
and have some permission in msdb.
See SQL Server 2005 Books Online topics:
Selecting an Account for the SQL Server Agent Service - http://
msdn2.microsoft.com/en-us/library/ms191543.aspx
Implementing SQL Server Agent Security - http://msdn2.microsoft.com/en-
us/library/ms190926.aspx
Security for SQL Server Agent Administration - http://
msdn2.microsoft.com/en-us/library/ms190978.aspx
SQL Server Agent Fixed Database Roles - http://msdn2.microsoft.com/en-
us/library/ms188283.aspx|||We've been unable to get the Agent Roles to work properly for domain account
s
in our environment. A SQL Login that is added to the SQLAgentOperatorRole is
able to create a job (with that login as the owner), edit the job, and
perform all other tasks as documented for this role. HOWEVER, if we add a
domain account to this role, it can create the job but cannot edit it. The
domain account is shown as the owner of the job. The domain account can star
t
the job but can't see the status and can't tell if it's running or not. It
can delete the job and make a new one but the button that should say 'edit'
says 'view'.
"Steve" wrote:

> On Feb 14, 1:47 pm, Don <D...@.discussions.microsoft.com> wrote:
> They will have to be a Login on the Server, a User in each database
> and have some permission in msdb.
> See SQL Server 2005 Books Online topics:
> Selecting an Account for the SQL Server Agent Service - http://
> msdn2.microsoft.com/en-us/library/ms191543.aspx
> Implementing SQL Server Agent Security - http://msdn2.microsoft.com/en-
> us/library/ms190926.aspx
> Security for SQL Server Agent Administration - http://
> msdn2.microsoft.com/en-us/library/ms190978.aspx
> SQL Server Agent Fixed Database Roles - http://msdn2.microsoft.com/en-
> us/library/ms188283.aspx
>
>
>

Wednesday, March 28, 2012

Granting Access permissions

Hi

I am using SQL Express2005 on my local machine. How do I grant access permissions to ASPNET in order to log onto a database? I have the SQL management studio installed to do this but I can't seem to find the option to grant permissions.

At the moment the access is granted to MYMACHINE_NAME\MY_USER_NAME.

I am using VS2003

Thanks

You need to add SQL login for that account: open Management Studio->connect to SQL Express->expand Security->Logins)>new login->new a Windows Authentication login named MACHINENAME\ASPNET->map the login to databases that it will access, and give proper permissions to it.|||

Hi,

Many Thanks...!