0

I have a Stored Procedure that takes Start Date and End Dates. So the Start Date must start from 1/1/2018. I want to make the Start Date as Dynamic- meaning when we are in 2019, the start Date will pick up 1/1/2019 and End Date is always Today's date. I appreciate for any help.

StartDate: 1/1/2018
EndDate: TodaysDate

Thanks


1 답변


0

you can get it in sql itself like this

SELECT
   DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0) AS StartOfYear,
   GETDATE() AS Today


  • Does GETDATE include time? - mjwills
  • I think it depends a lot from the DBMS :) - CodeNotFound
  • No, it does not include time. But I want to hold the start date in a variable and use that variable in every startdate in the body of SP instead of using Static Date. - John
  • No, it does not include time. GETDATE does include time. - mjwills

Linked


Related

Latest