Skip to main content

How to write 'case' in Custom SQL, please let me know with example.


Here is the situation (SQL query) that I need to perform on Date table & likes to update 'IND' column where DateValue is default column in Date table


select
case when GETDATE()<=DateValue then 'N' else 'Y' end as 'IND' ,* from <table_name> order by DateValue desc

Hi Sai, Thanks for posting! Do this: 

  1. Right click the table > Add Field > Name it 'IND'
  2. Right click the field > Add transformation > operator 'Fixed value', Value: 'Y' > Click Add
  3. Right click the field again > Add Transformation > operator 'Fixed value', Value: 'N' > Click Add
  4. Right click the 'Fixed Value: N' Transformation > Add Condition > In the condition pane, Operator: 'Custom Condition' > Click Add
  5. Type: "GETDATE()<==DateValue]" > Click OK

You Should end up with something like this: 

 


Reply