I am passing two variables like SDate
and EDate
to stored procedure and I want select data from table whereVDate
is betwwen SDate
and EDate
if both
SDate
and EDate
is not null .If EDate
is null then I want to select data where VDate
= SDate
.I have tried using If..Else
andCase
in where clause but it was giving incorrect syntx error. Query :
SELECT
Column1 ,column2fromTable twhere t.VDate IN(If EDate ISNOTNULLSELECT
VDate FROMTablewhere VDate BETWEEN SDate AND EDateELSE
SDate)
Any help would be appreciated.