Hari Krishna

Hari Krishna

  • NA
  • 129
  • 48.2k

select case in sql server for date filter

Mar 28 2018 9:51 AM

Hi team,

I am working on sqlserver ,i want to filter the date condition in select case where condition

in the sql server stored procedure,
i tried in the below query but i am getting exception:

An unexpected token ">=" was found following "". Expected tokens may include: "ELSE WHEN END OVER CON

my query

Select * from OPENQUERY(DB2TEST ,'SELECT distinct tlf.* FROM TESTDB2 .TLEXP tlf

where tlf.VEH_SER_NO IS NOT NULL AND

( CASE WHEN tlf.OPN_STS_CD=''CAN'' THEN date(tlf.CANC_DATE ) >= date(''2018-03-18'')

else date(tlf.TS_ISS) >= date(''2018-03-18'')

end )

order by tlf.TS_ISS desc')

 

Answers (2)