Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Can’t use double quotes w/ SQL 7 INSERT
I have an odd situation to say the least. I am trying to use double quotes to my SQL INSERT but I can’t make it work. Check this code and my question below please:
** read the values in table
** the NVL funtion is to insert blanks if there is nothing on that field
lc1= NVL(sid,'') && char
lc2= NVL(Appstat,'') && char
** INSERT works here:
l_cSQL = "INSERT INTO ADMStat"
l_cSQL = l_cSQL + " (sid,trkgrp)"
l_cSQL = l_cSQL + " VALUES ("
l_cSQL = l_cSQL + "'" + ALLT(lc1) + "'"
l_cSQL = l_cSQL + ",'" + ALLT(lc2) + "')"
lnResult=SQLEXEC(l_nHandle,l_cSQL)
_CLIPTEXT=l_cSQL
**in this case, this is the value of clip text= INSERT INTO ADMStat (sid,trkgrp) VALUES ('037643431','')
but if I try to change the from single quotes to double like this it will NOT work:
l_cSQL = 'INSERT INTO ADMStat'
l_cSQL = l_cSQL + ' (sid,trkgrp)'
l_cSQL = l_cSQL + ' VALUES ('
l_cSQL = l_cSQL + '"' + ALLT(lc1) + '"'
l_cSQL = l_cSQL + ',"'+ ALLT(lc2) + '")'
lnResult=SQLEXEC(l_nHandle,l_cSQL)
_CLIPTEXT=l_cSQL
value of clip text = INSERT INTO ADMStat (sid,trkgrp) VALUES ("037643431","")
This is the odd thing. Like I said, the second one does not work in the program, but if I get both values of the clip text into the SQL Server Query Analyzer and run them, they BOTH run.
What is wrong?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement