Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connecting to a remote Microsoft server running MsSQL via PHP. The code looks something like:

$con = mssql_connect('', 'user', 'pass')
    or die(log_mssql_error(__FILE__, __LINE__, mssql_get_last_message()));
mssql_select_db('ShipWorks', $con)
    or die(log_mssql_error(__FILE__, __LINE__, mssql_get_last_message()));

mssql_query($query = "UPDATE [Foo].[dbo].[Bar] SET Biz = 'ABC' WHERE Baz = 'XYZ'")
    or die(log_mssql_error(__FILE__, __LINE__, mssql_get_last_message(), $query));

I receive the following error

The UPDATE permission was denied on the object 'Bar', database 'Foo', schema 'dbo'.

  • In the object explorer, in 'Server' > Databases > 'Foo' > Security > Users > 'user' I've set GRANT on all the securables.
  • And in 'Server' > Databases > 'Foo' properties, I'ved added the 'user' user and given all GRANT permissions as well.

I feel like I've covered all the bases but I'm still getting the permission denied error. What did I miss?

share|improve this question

migrated from May 29 '13 at 8:24

This question came from our site for system and network administrators.

up vote 1 down vote accepted

I've set GRANT on all the securables.

You want to assign roles to write data for a specific database. When I read this correct you clicked everthing to do this.

Now I think that your user is member of the role db_datawriter and db_denydatawriter. Please remove the role db_denydatawriter and try it again.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.