Is it possible to use a variable value in SQL as part of an automation? I’ve seen examples where I can use a variable value in the WHERE clause to filter values selected. That’s not what I’m talking about. Here’s my use case:
I have many tables on one database and I want to copy the data from them to another database. I just want to select all the rows from table1 in database A and insert into table1 in database B. I’ve been able to write an automation to do it for one table, but I’d have to change it each time I run it for a different table name.
I have a list of all the tables and I want to loop through the list and replace the table name in the sql each time with the name from the current row in the list. I was thinking I could do something like this, but it doesn’t like the # signs in the SQL.
Select * from #tableName#
Any of you automation experts run into something like this before or have any ideas? Please ask for clarification if it doesn’t make sense.
Thanks in advance for any assistance