Question : $INSERT permission denied on object 'TABLE NAME',  database 'ACB', owner 'dbo'. sp_ABC

I have created a login 'c_test' with 'public' and 'db_datareader' DatabaseAccess on a database 'ABC'

I have created a stored proc say 'sp_ABC' using sa login(owner dbo) and granted execute permission to  'c_test'

In the stored proc, I have written a dynamic SQL inserting a record in one of the tables in 'ABC' database.

The dynamic SQL is stored in a variable @mString varchar(8000)

Now while executing the dynamic SQL from within the stored proc using

exec (@mString) command

It gives error "$INSERT permission denied on object 'TABLE', database 'ABC', owner 'dbo'..."

The following error is also encountered while updating and deleting a record using the exec command.

For normal inserts, updates and delete when i faced the similar problem i prefixed dbo. to the table name in each of the queries. Doing the same with dynamic sql for insert, update and delete is still not solving the problem

I CANNOT CHANGE THE PERMISSIONS  as the database is of Client and there are lot of other applications running on it.

Pls suggest a solution for the same.

Regards,
Chetan
email:[email protected]

Pls suggest how to solve this problem.

Answer : $INSERT permission denied on object 'TABLE NAME',  database 'ACB', owner 'dbo'. sp_ABC

That article also contains a workaround using a temporary table that may be viable.  But I have to admit I have never tested it, and probably never will.  Dynamic SQL is verbotten here.
Random Solutions  
 
programming4us programming4us