Write a chunk of sql into a variable
Posted: Wed Sep 25, 2013 11:53 pm
Hi Guys,
I've got the following sql statement in live code, which I would like to write and execute as elegantly as possible. My connection ID is stored in a field called gConnID. I've got the code below broken down, but its not working, can someone help me to write it broken down.
I've got the following sql statement in live code, which I would like to write and execute as elegantly as possible. My connection ID is stored in a field called gConnID. I've got the code below broken down, but its not working, can someone help me to write it broken down.
Code: Select all
put "CREATE TEMPORARY TABLE tmp AS SELECT customerID, title, first_name, last_name, position, telephone, mobile, email FROM customer_contact WHERE customerID=" && var_customerID && ";" into tTheSQLQuery1
put "UPDATE tmp SET customerID=" && new_customer_id &&";" into tTheSQLQuery1
put "INSERT INTO customer_contact(customerID, title, first_name, last_name, position, telephone, mobile, email) SELECT * FROM tmp; " into tTheSQLQuery1
put "DROP TABLE tmp;" into tTheSQLQuery1
revExecuteSQL gConnID, tTheSQLQuery1