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?
Best Answer
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
anddb_denydatawriter
. Please remove the roledb_denydatawriter
and try it again.