I have a set of permissions which can potentially apply to about 15 different tables. What I want to do is be able to call these permissions dynamically so that I don't have to split a block of logic into two Stored Procedures.
Basically, I have a block of logic in which a "working" table is dropped and recreated (and permissions are part of that process). Once recreated, I do a BCP and then manipulate the new data as needed. Currently, in order to do this, I have to split the logic over two Stored Procedures (split after the GRANT).
I was thinking that I could just create a dynamic Stored Procedure to handle the GRANT and pass it in the name of the table to grant the permissions on. My problem is that I can't seem to get past a 'Syntax Error' when I try and put my parameter into the GRANT statement.
Am I trying to do the impossible?
Basically, I have a block of logic in which a "working" table is dropped and recreated (and permissions are part of that process). Once recreated, I do a BCP and then manipulate the new data as needed. Currently, in order to do this, I have to split the logic over two Stored Procedures (split after the GRANT).
I was thinking that I could just create a dynamic Stored Procedure to handle the GRANT and pass it in the name of the table to grant the permissions on. My problem is that I can't seem to get past a 'Syntax Error' when I try and put my parameter into the GRANT statement.
Am I trying to do the impossible?