Quantcast
Channel: Toad Data Point Forum - Recent Threads
Viewing all articles
Browse latest Browse all 2544

RE: Using a variable value in Automation SQL

$
0
0

This can be done but it is not Toad that is your problem, it is SQL.  SQL does not like variables as table names or fields, just values.  You have to use dynamic SQL.  Basically build the entire SQL command as string and then execute the SQL command string:

Declare @SqlCmdString as varchar(2000) = 'select * from ' + #Loop_data_1_SQL#

Exec (@SqlCmdString)

Try that. 

Note: for Oracle use || instead of + to concatonate text and Execute Immediate YourVariableName instead of Exec(YourVariablenName).


Viewing all articles
Browse latest Browse all 2544

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>