Subject | Re: [firebird-support] UNION Problems |
---|---|
Author | Helen Borrie |
Post date | 2005-01-17T14:52:54Z |
At 01:56 PM 17/01/2005 +0000, you wrote:
someone cuts off his intravenous chocolate. :-)
beginning. The syntax of the CAST expression is wrong. It should be
SELECT CAST(lrgAddrData AS VARCHAR(10) )
But you will (potentially) encounter another exception when you get to the
second SELECT (an overflow exception).
The overflow occurs if the column contains a number larger than 9 (the
largest integer that can be cast as CHAR). Play safe and cast this as
VARCHAR(10) as well.
As a rule, cast date types as char(n) and numbers as varchar(n).
./hb
>I am having problems using the union operator on two tables. CouldYup. And don't believe everything Martijn says. He gets like this when
>somebody point out my mistake.
someone cuts off his intravenous chocolate. :-)
>Below is the SQL code.OK, the line that is causing the 'invalid token' exception is right at the
>
>
>SELECT CAST LrgAddrData
>FROM LargeAddress
>WHERE WPVBSQ < 20
>UNION ALL
>SELECT CAST (SmllAddrData AS CHAR)
>FROM SmallAddress
>WHERE WPVBSQ < 20
beginning. The syntax of the CAST expression is wrong. It should be
SELECT CAST(lrgAddrData AS VARCHAR(10) )
But you will (potentially) encounter another exception when you get to the
second SELECT (an overflow exception).
The overflow occurs if the column contains a number larger than 9 (the
largest integer that can be cast as CHAR). Play safe and cast this as
VARCHAR(10) as well.
As a rule, cast date types as char(n) and numbers as varchar(n).
./hb