0

I'm connecting to a remote 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?

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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