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
Best answer by JTreadwell
Hi Sai, Thanks for posting! Do this:
Right click the table > Add Field > Name it 'IND' Right click the field > Add transformation > operator 'Fixed value', Value: 'Y' > Click Add Right click the field again > Add Transformation > operator 'Fixed value', Value: 'N' > Click Add Right click the 'Fixed Value: N' Transformation > Add Condition > In the condition pane, Operator: 'Custom Condition' > Click Add Type: "GETDATE()<=[DateValue]" > Click OK You Should end up with something like this:
View original