I have this line I am struggling with to convert a query from Oracle to SQL Server 2012. the following line is:
DECODE(SUM(DECODE(a.canceldate, NULL, 1,0)), 1, NULL, To_Date(MAX(TO_CHAR(a.canceldate,'yyyymmdd')), 'yyyymmdd')) dCancelDate,
As I inteprete is to convert it like:
case a.canceldate
(when sum(case a.canceldate when Null then 1 else 0 end))
when 1
then 0
else convert(datetime,a.canceldate)
end max(a.canceldate) as dCancelDate,
I will appreciate some assistant, my line is not correct for SQL Server 2012.