Board index » delphi » Invalid use of keyword token IF

Invalid use of keyword token IF

Hi.
I am using Sybase Sqlanywhere database with Delphi 4.0
To update the field ComponentCode in table "InterfaceSrcDst" I am using this
query  .

SELECT if SrcComponentsParent.ComponentCode is Null then

Quote
>SrcComponents.ComponentCode Else
>SrcComponentsParent.ComponentCode EndIf as SrcParentCode ,
>if SrcComponentsParent.ComponentCode is not Null then
>SrcComponents.ComponentCode Else
>Null EndIf as SrcChildCode
>FROM "DBA"."InterfaceSrcDst" left outer
>join Components as SrcComponents on srcComponentCode=ComponentCode
>left outer join Components as SrcComponentsParent on
>SrcComponentsParent.ComponentCode=SrcComponents.ComponentParentCode

This  sql sentence is valid in Isql but in Delphi
I get error message "Invalid use of  keyword token IF"
 

Re:Invalid use of keyword token IF


On Sat, 18 Sep 1999 10:27:09 +0200, "Yossi Naveh" <yos...@eingev.org.il>
wrote:

Quote
>I am using Sybase Sqlanywhere database with Delphi 4.0
>To update the field ComponentCode in table "InterfaceSrcDst" I am using this
>query  .

>SELECT if SrcComponentsParent.ComponentCode is Null then
>>SrcComponents.ComponentCode Else
>>SrcComponentsParent.ComponentCode EndIf as SrcParentCode ,
>>if SrcComponentsParent.ComponentCode is not Null then
>>SrcComponents.ComponentCode Else
>>Null EndIf as SrcChildCode
>>FROM "DBA"."InterfaceSrcDst" left outer
>>join Components as SrcComponents on srcComponentCode=ComponentCode
>>left outer join Components as SrcComponentsParent on
>>SrcComponentsParent.ComponentCode=SrcComponents.ComponentParentCode

>This  sql sentence is valid in Isql but in Delphi
>I get error message "Invalid use of  keyword token IF"

Is the error coming from the BDE or SQL Anywhere? I suspect it is the
latter, but I could be wrong.

To my knowledge, standard SQL does not include an IF construct. It does
include a CASE construct that seems to match your structuring and logic.
Have you tried that?

==========================================================================
Steve Koterski                  "Computers are useless. They can only give
Technical Publications          you answers."
Borland                                       -- Pablo Picasso (1881-1973)
http://www.borland.com/techpubs/delphi

Other Threads