I have a problem when trying to execute this update statement (below) using C# SqlCommand when I execute it locally it works fine, but when deployed to another machine I got a permission error
The SELECT permission was denied on the object Order …
The UPDATE permission was denied on the object Order …
Update Statement
UPDATE Order SET Request = @request WHERE Id = @ID;
Is there any way to add GRANT SELECT and GRANT UPDATE to a single statement like the update above without using a stored procedure?
or the SP is the way to go on this?
Thanks in advance
Stored procedure is the way to go, then you can assign execute rights to that stored procedure without granting rights on the base table. SQL Server cannot assign rights to individual ad hoc SQL statements.