Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Mon, 22 Oct 2001 @ 18:47:44 GMT

  <Prev Next>  
Next> Last>>  

Subj:   SQL question (see red line below)
From:   Tony Howe

In the following query, I want the result of the CASE which is put into "FLAG" to be an INTEGER field. How do I do this??

 CASE WHEN SUBSTR(DX1,1,3) IN('290','V11','V40')   THEN 1
      WHEN SUBSTR(DX1,1,3) BETWEEN '293' AND '302' THEN 1
      WHEN SUBSTR(DX1,1,3) BETWEEN '306' AND '316' THEN 1
      WHEN SUBSTR(DX1,1,4) IN('V170','V611','V612',
         'V701','V702','V704','V790','V798','V799') THEN 1
      WHEN DX1 IN('V6283','V6540','V6545','V6549',
           'V7101','V7102','V7109','V7389') THEN 1
      WHEN SUBSTR(DX1,1,3) IN('291','292','303','304','305','969')
                                                   THEN 2
      WHEN SUBSTR(DX1,1,4) IN('9650','9658','9685','V791','V113')
                                                   THEN 2
      WHEN DX1 = 'V6542'                           THEN 2
      WHEN SUBSTR(DX1,1,3) IN('042','V08')         THEN 4
      WHEN SUBSTR(DX1,1,4) ='V017'                 THEN 4
      WHEN DX1 IN('07953','79571','V6544')         THEN 4
      ELSE 0
 END                 AS FLAG        **HOW CAN I MAKE "FLAG" AN INTEGER

  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020