Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 9 of 9 total |
update set |
Sat, Jan 28 2012 12:56 PM | Permanent Link |
AlanL | Hello all,
I want to update a field in a DBIsam table with a combination of 3 fields. Field1 and Field2 are string and Field3 is Double but when I run the query I get the error message:- DBISAM Engine Error #11949 SQL parsing error - Expected ) but instead found ( in UPDATE SQL statement at line 1, column 57. I am not sure what is going on. Can you please help. The code I use is:- with Query1 do begin close; SQL.Clear; SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + FloatToStr(Field3))'); Exec.SQL; end I am using Delphi7 pro + dbisam v4.26 Build 3 many thanks, AlanL |
Sat, Jan 28 2012 1:25 PM | Permanent Link |
Fernando Dias Team Elevate | Alan,
SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + CAST(Field3 AS VARCHAR(20)) )'); -- Fernando Dias [Team Elevate] |
Sun, Jan 29 2012 3:56 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | AlanL
Just to expand a bit on Fernado's answer - SQL doesn't have a FloatToStr function (which is why he's using CAST) and the way you have the SQL written that is simply passed as a string to the engine. An alternative to Fernado's approach would be SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + ' + FloatToStr(Field3) + ')'); ie convert Field3 in Delphi and pass that into the SQL statement. Roy Lambert [Team Elevate] |
Sun, Jan 29 2012 8:39 AM | Permanent Link |
John Hay | > SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + ' + FloatToStr(Field3) + ')'); That would be SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + ' + QuotedStr(FloatToStr(Field3)) + ')'); John |
Sun, Jan 29 2012 8:50 AM | Permanent Link |
AlanL | "John Hay" wrote:
> SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + ' + FloatToStr(Field3) + ')'); That would be SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + ' + QuotedStr(FloatToStr(Field3)) + ')'); John Thank you all very much for your help Fernando,Roy and John. I have tried your examples and it is now working fine now. best regards, Alan |
Sun, Jan 29 2012 9:52 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | John
Mea culpa Roy Lambert |
Sun, Jan 29 2012 10:53 AM | Permanent Link |
Fernando Dias Team Elevate | John,
<< That would be SQL.Add ('UPDATE DATFILE SET Field4 =(Field1 + Field2 + ' + QuotedStr(FloatToStr(Field3)) + ')'); >> That wouldn't work either. Field3 is a column name, not a Delphi variable. -- Fernando Dias [Team Elevate] |
Sun, Jan 29 2012 11:26 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Fernando
At least John's sharing the shame of THAT one Roy Lambert |
Mon, Jan 30 2012 3:26 AM | Permanent Link |
John Hay | Lucky your brain is working Fernando
|
This web page was last updated on Monday, April 29, 2024 at 05:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |