Where Conditions [C#] - DATEPART
Where Conditions [C#] - DATEPART
Hi,
is it possibile to use SQL functions as DATEPART in the Where Conditions?
Given this example with DATE_ADD:
editor.Where( q =>
q.Where( "date", "DATE_ADD( NOW(), INTERVAL -14 DAY )", ">=", false );
);
I tried to modify it to use DATEPART, but without success.
The resulting query should be something like:
SELECT * FROM ... WHERE CONVERT(VARCHAR(MAX), DATEPART(year, [Date])) = '2022'
or just
SELECT * FROM ... WHERE DATEPART(year, [TransfectionDate]) = '2022'
Thanks!!
This question has an accepted answers - jump to answer
Answers
Hi,
Should do the job. I've just tested it locally and it looks good.
Allan
Thanks Allan!