SouthwestNut
Programmer
In summary I have 14 views each ending with a 3 digit number. The 3 digit numbers correspond to different business units, each of which must be kept separate. I have had to create a global temporary table (##) using each view, hence I could have up to 14 temp tables. I have a need to drop them when a new user wants to rerun the report using different criteria.
In VBA, I could write a statement such as the following:
DoCmd.RunSQL "DELETE * FROM [" & vstrTable & "];"
Then I could just pass in the parameter and the contents of the table would be erased.
I am wondering about the likelihood of doing the same thing in a SQL Stored Procedure, using a predefined variable in a FROM clause. Can this be done?
If not I will have to write 14 stored procedures to drop temporary tables, not a big deal, but I hate to clutter my objects window with a lot of redundant procedures.
In VBA, I could write a statement such as the following:
DoCmd.RunSQL "DELETE * FROM [" & vstrTable & "];"
Then I could just pass in the parameter and the contents of the table would be erased.
I am wondering about the likelihood of doing the same thing in a SQL Stored Procedure, using a predefined variable in a FROM clause. Can this be done?
If not I will have to write 14 stored procedures to drop temporary tables, not a big deal, but I hate to clutter my objects window with a lot of redundant procedures.