I am struggeling on a sql statement and can't find the correct syntax for this.
Im programming with teamdeveloper 6.1 and I am using the function SqlPrepareAndExecute(...)
What i'm trying is to insert a set of values. On mysql it would be some like:
INSERT INTO supportContacts
(type, details)
VALUES
('Email', '[email protected]'),
('Twitter', '@sqlfiddle');
With SqlTalk i can do this...
INSERT INTO SYSADM.FOOBAR VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
\
$datatypes CHARACTER,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC
"01",0,0,0,0,0,0,0,0,0,0,0,0
"02",0,0,0,0,0,0,0,0,0,0,0,0
"03",0,0,0,0,0,0,0,0,0,0,0,0
"04",0,0,0,0,0,0,0,0,0,0,0,0
"05",0,0,0,0,0,0,0,0,0,0,0,0
"06",0,0,0,0,0,0,0,0,0,0,0,0
"07",0,0,0,0,0,0,0,0,0,0,0,0
"08",0,0,0,0,0,0,0,0,0,0,0,0
/
Bot both won't work when I fill a variable and use it in the SqlExecute function of TD 6.1
I allways get errors like Statement not ended properly
or Invalid constant
.
I also tried to put the values like:
('01',0,0,0,0,0,0,0,0,0,0,0,0),
('02',0,0,0,0,0,0,0,0,0,0,0,0),
('03',0,0,0,0,0,0,0,0,0,0,0,0), ...
Error...
what am I doing wrong ?
EDIT (Things I have tried untill now):
Try 1
Try 2
"INSERT INTO SYSADM.FOOBAR VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
\
$datatypes CHARACTER,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC,NUMERIC
'01',0,0,0,0,0,0,0,0,0,0,0,0
'02',0,0,0,0,0,0,0,0,0,0,0,0"
What only sayes SQL command not properly ended
Try 3
I thought may its because of the \
. Actually it is a escapechar so I escaped it like
"INSERT INTO SYSADM.FOOBAR VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
\\
$datatypes....
Now it sayed Invalid Character
Try 4
"INSERT INTO SYSADM.FOOBAR VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
\
$da...
\'01\',0,0,0,0,0,0,0,0,0,0,0,0
\'02\',0,0,0,0,0,0,0,0,0,0,0,0"
Was a fail also! :)
This may just be due to the example query, but I'm not sure whether you are aware how databinding works in TD:
where var1, var2, var3 are variables visible in the function that calls SqlExecute/SqlPrepareAndExecute