Take the 2-minute tour ×
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. It's 100% free, no registration required.

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

$con = mssql_connect('0.0.0.0:123', '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 serverfault.com May 29 '13 at 8:24

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

1 Answer 1

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

 
discard

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.