Subject | RE: [firebird-support] Firebird Verison of this MySQL command |
---|---|
Author | Svein Erling Tysvær |
Post date | 2013-02-04T14:32:27Z |
>I am trying to update a coloum in Firebird via the following SQL commandHi Andy!
>
>SQLCommand = vbNullString
>SQLCommand = SQLCommand & "UPDATE ProductTable "
>SQLCommand = SQLCommand & "SET "
>SQLCommand = SQLCommand & "CURRENTLEVELS = CURRENTLEVELS - '" & Format(Readin(3), "#####0") & "' "
>
>SQLCommand = SQLCommand & "WHERE "
>SQLCommand = SQLCommand & "BARCODENUMBER='" & Readin(2) & "' and "
>SQLCommand = SQLCommand & "STOCKCONTROLYN='1';"
>
>ReadIn(3) is a value that comes from the data file
>
>My problem is this The above SQL command works on MySQL, MSSQL, PostgreSQL But it will not work on
>Firebird
>
>My application that is doing the processing crashes when it run agenst Firebird
>
>So what is the Firebird version of this?
>
>basically I want to update the CURRENTLEVELS orginal value but take away the
>Readin(3) value
Basically, your SQL call is something like:
UPDATE ProductTable
SET CurrentLevels = CurrentLevels - '<value>'
WHERE BarcodeNumber = '<AnotherValue>'
AND StockControlYN = '1'
The problem I see here, is that <value> seems to be a string - there should not be ' around the value if it is a number. Firebird does not support deducting from a string, at least not this way (there may be UDFs or similar that can do it). If BarcodeNumber and StockControl are CHAR or VARCHAR, then it is of course correct to use ' around them.
HTH,
Set