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

Wednesday, March 21, 2012

Problem performing remote queries

I am trying to a simple insert statement from a remote application
against a sql server 2005 database. To fix the problem I was having,
I had to grant the Login I was using the role of sysadmin. However I
don't want this user to have that kind of control, what would be the
best role to allow the user full access(including remoting) to only
one particular database?rhaazy pisze:

Quote:

Originally Posted by

I am trying to a simple insert statement from a remote application
against a sql server 2005 database. To fix the problem I was having,
I had to grant the Login I was using the role of sysadmin. However I
don't want this user to have that kind of control, what would be the
best role to allow the user full access(including remoting) to only
one particular database?


First, tell us what the problem was (provide an error message or other
details).

You can configure detailed permissions in SQL Server 2005, granting
sysadmin server role is far too much. Grant the login only enumerated
permissions that are essential to perform certain tasks (simple insert
in your case). Here is an T-SQL statement to do it:

GRANT INSERT ON your_table TO some_user;

Of course there are alternate solutions - e.g. database role
(db_datawriter), but try that one I mentioned above.

--
Best regards,
Marcin Guzowski
http://guzowski.info|||The error message is simply that my user didn't have permission to
execute the statement.

I would like to be able to grant the user insert, update, delete,
select on all tables in a particular database.(remotely or local, both
situations are possible)

How would I do this?|||rhaazy pisze:

Quote:

Originally Posted by

The error message is simply that my user didn't have permission to
execute the statement.
>
I would like to be able to grant the user insert, update, delete,
select on all tables in a particular database.(remotely or local, both
situations are possible)
>
How would I do this?


Permissions are assigned to logins/users and there is no difference
between remote and local scenario.

If you want all DML operations granted on all tables in particular
database, simply grant two database roles to your database user:

USE your_database;
GO
EXEC sp_addrolemember N'db_datareader', N'database_user';
GO
EXEC sp_addrolemember N'db_datawriter', N'database_user';
GO

--
Best regards,
Marcin Guzowski
http://guzowski.info|||As it turns out the db_owner is a more likely canidate for the level
of power I wish to give the user.

So what I need to do is add to my database install script, after I add
the user to the database, i need to grant Database Role Membership
(db_owner) for the database ClientScan for the user CSAdmin

exec sp_addlogin 'CSAdmin', 'pwd'

USE ClientScan
exec sp_adduser 'CSAdmin'

exec sp_addrolemember db_owner, CSAdmin

If there is anything wrong with my syntax please correct it.|||rhaazy (rhaazy@.gmail.com) writes:

Quote:

Originally Posted by

As it turns out the db_owner is a more likely canidate for the level
of power I wish to give the user.
>
So what I need to do is add to my database install script, after I add
the user to the database, i need to grant Database Role Membership
(db_owner) for the database ClientScan for the user CSAdmin
>
exec sp_addlogin 'CSAdmin', 'pwd'
>
USE ClientScan
exec sp_adduser 'CSAdmin'
>
exec sp_addrolemember db_owner, CSAdmin
>
If there is anything wrong with my syntax please correct it.


Since you are on SQL 2005, I would suggest that you use CREATE LOGIN
and CREATE USER rather than sp_adduser and sp_addlogin.

Note that there is a difference between CREATE USER and sp_adduser: the
latter will create a schema called CSAdmin and make that the default
schema for CSAdmin. If you only use CREATE USER, CSAdmin's default schema
will be dbo, and no schema CSAdmin will be created.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspxsql

Tuesday, March 20, 2012

problem on grant permission to user

I have two kinds of functions in the database that need to grant exec permission to user appUser.
The first kind of function return ordinary datatype, let's call it funcReturnDataType here.
The second kind of function return table datatype, let's call it funcReturnTable
When I issued the folloing command to appUser, no problem.
grant exec on funcReturnDataType to appUser

However when I issued:
grant exec on funcReturnTable to appUser

I got the following error message:
Server: Msg 4606, Level 16, State 1, Line 1
Granted or revoked privilege EXECUTE is not compatible with object.

Any suggestions to resolve this problem?

Thank you!I'm having the same problem. Can anyone help.|||

Maybe this will help you:

http://msdn2.microsoft.com/en-us/library/ms188371.aspx

from the article:

....

permission
Specifies a permission that can be granted on a schema-contained object. For a list of the permissions, see the Remarks section later in this topic.

ALL
Granting ALL does not grant all possible permissions. Granting ALL is equivalent to granting all ANSI-92 permissions applicable to the specified object. The meaning of ALL varies as follows:

Scalar function permissions: EXECUTE, REFERENCES.
Table-valued function permissions: DELETE, INSERT, REFERENCES, SELECT, UPDATE.
Stored procedure permissions: EXECUTE, SYNONYM, DELETE, INSERT, SELECT, UPDATE.
Table permissions: DELETE, INSERT, REFERENCES, SELECT, UPDATE.
View permissions: DELETE, INSERT, REFERENCES, SELECT, UPDATE.

....

problem on grant permission to user

I have two kinds of functions in the database that need to grant exec permission to user appUser.
The first kind of function return ordinary datatype, let's call it funcReturnDataType here.
The second kind of function return table datatype, let's call it funcReturnTable
When I issued the folloing command to appUser, no problem.
grant exec on funcReturnDataType to appUser

However when I issued:
grant exec on funcReturnTable to appUser

I got the following error message:
Server: Msg 4606, Level 16, State 1, Line 1
Granted or revoked privilege EXECUTE is not compatible with object.

Any suggestions to resolve this problem?

Thank you!I'm having the same problem. Can anyone help.|||

Maybe this will help you:

http://msdn2.microsoft.com/en-us/library/ms188371.aspx

from the article:

....

permission
Specifies a permission that can be granted on a schema-contained object. For a list of the permissions, see the Remarks section later in this topic.

ALL
Granting ALL does not grant all possible permissions. Granting ALL is equivalent to granting all ANSI-92 permissions applicable to the specified object. The meaning of ALL varies as follows:

Scalar function permissions: EXECUTE, REFERENCES.
Table-valued function permissions: DELETE, INSERT, REFERENCES, SELECT, UPDATE.
Stored procedure permissions: EXECUTE, SYNONYM, DELETE, INSERT, SELECT, UPDATE.
Table permissions: DELETE, INSERT, REFERENCES, SELECT, UPDATE.
View permissions: DELETE, INSERT, REFERENCES, SELECT, UPDATE.

....