How to concatenate my sql statement..?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to concatenate my sql statement..?
Hello livecoders,
Just wanna ask how can I concatenate my sql statement I have 100 columns in my table in my script
---------> put "CREATE TABLE CBMS_Details (A_1A char(10), City A_1B(10), A_1C char(10), A_1D char(10) \
,A_1E char(10))" into tSQL
--------> revExecuteSQL conn, tSQL
so I wanna make it 10 columns each line I tried the script above it was wrong. I use \ to concatenate.. Not working..
Need help..
Thank you..
Regards
-snop21
Just wanna ask how can I concatenate my sql statement I have 100 columns in my table in my script
---------> put "CREATE TABLE CBMS_Details (A_1A char(10), City A_1B(10), A_1C char(10), A_1D char(10) \
,A_1E char(10))" into tSQL
--------> revExecuteSQL conn, tSQL
so I wanna make it 10 columns each line I tried the script above it was wrong. I use \ to concatenate.. Not working..
Need help..
Thank you..
Regards
-snop21
Re: How to concatenate my sql statement..?
Code: Select all
put "CREATE TABLE CBMS_Details (A_1A char(10), City A_1B(10), A_1C char(10), A_1D char(10)"& \
",A_1E char(10))" into tSQL
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to concatenate my sql statement..?
Or if it is just for legibility, then it can be much more readable to break up the string into sections...
put "CREATE TABLE CBMS_Details " into tSQL
put "(A_1A char (10))" after tSQL
Obviously add the rest of the column definitions - I did not as I am on phone keyboard and too lazy.
If you go even further you can make it something like
put "CREATE TABLE CMS_Details" into tSQLaction
put "(A_1A char (10))" into tSQLoptions
put tSQLaction && tSQLoptions into tSQL
Note the differences in handling space between clauses.
put "CREATE TABLE CBMS_Details " into tSQL
put "(A_1A char (10))" after tSQL
Obviously add the rest of the column definitions - I did not as I am on phone keyboard and too lazy.
If you go even further you can make it something like
put "CREATE TABLE CMS_Details" into tSQLaction
put "(A_1A char (10))" into tSQLoptions
put tSQLaction && tSQLoptions into tSQL
Note the differences in handling space between clauses.
Re: How to concatenate my sql statement..?
You are trying to concatenate a STRING with \, but that does only work with a SCRIPT!
Simon and SparkOut already gave the solution.
Simon and SparkOut already gave the solution.
Re: How to concatenate my sql statement..?
With 100 columns... with you bother to type the query ?
You should use a loop to create it.
You should use a loop to create it.
Code: Select all
put "CREATE TABLE CBMS_Details (" into tSQL
repeat with i = 1 to 100
put "A_"&i&"A char(10), City A_"&i&"B(10), A_"&i&"C char(10), A_"&i&"D char(10),A_"&i&"E char(10)," after tSQL
end repeat
delete last char of tSQL
put ")" after tSQL
revExecuteSQL conn, tSQL
Re: How to concatenate my sql statement..?
YES! 
Your message contains 7 characters. The minimum number of characters you need to enter is 10.

Your message contains 7 characters. The minimum number of characters you need to enter is 10.