|  |  | Archives of the TeradataForumMessage Posted: Mon, 22 Oct 2001 @ 20:18:06 GMT
 
 
  
| Subj: |  | Re: SQL question (see red line below) |  |  |  | From: |  | David Hough |  
 Tony: Adding the (INTEGER) between END and AS FLAG works for me on V2R4.0.2, but I seem to remember problems like this on older versions.  Try
enclosing your CASE statement in parentheses, and then applying the cast like this: 
  SELECT
 (CASE WHEN SUBSTR(DX1,1,3) IN('290','V11','V40')   THEN 1
.
.
.
      WHEN DX1 IN('07953','79571','V6544')         THEN 4
      ELSE 0
 END)  (INTEGER)               AS FLAG
FROM DB2WHSP.V_RALS_IP_CLAIM
The extra parens are sometimes needed around the first argument of a CAST() operation, too. Does that help? /dave hough 
 
 |  |