我在 sql 语句上苦苦挣扎,找不到正确的语法。
我正在使用 teamdeveloper 6.1 进行编程,我正在使用该功能SqlPrepareAndExecute(...)
我正在尝试的是插入一组值。在 mysql 上会是这样的:
INSERT INTO supportContacts
(type, details)
VALUES
('Email', 'admin@sqlfiddle.com'),
('Twitter', '@sqlfiddle');
使用 SqlTalk 我可以做到这一点......
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
/
当我填充变量并在 TD 6.1 的 SqlExecute 函数中使用它时,Bot 都不起作用
我总是得到类似Statement not ended properly
or的错误Invalid constant
。
我还尝试将这些值设置为:
('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), ...
错误...
我究竟做错了什么 ?
编辑(到目前为止我尝试过的事情):
试试 1
试试 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"
只说什么SQL command not properly ended
尝试 3
我想可能是因为\
. 实际上它是一个 escapechar 所以我逃脱了它
"INSERT INTO SYSADM.FOOBAR VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
\\
$datatypes....
现在它说无效字符
尝试 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"
也失败了!:)