i am trying to convert below oracle query to SQL server query.
Select * from table A WHERE TRUNC(a.Generate_DATE,'MM') = (SELECT (NVL (TRUNC (TO_DATE ('$$date','MM/DD/YYYY HH24:MI:SS')),TRUNC(ADD_MONTHS(SYSDATE, -1),'MM'))) FROM DUAL) where $$date is parameter value and will be passed from outside the query.
The issue is with dateformat.I am unable to convert this exact format in sql server.
WHERE DateColumn = @DataParameteror perhapsWHERE DateColumn >= @StartDate AND DateColumn < @EndDate.2021-02-01look for rows where the column's value is>= '2021-02-01'and< '2021-03-01'. Like I said, basic date logic.