Hi @Rohit Kulkarni ,
Thankyou for using Microsoft Q&A platform and posting your question.
While declaring variables you have kept the expression inside single quotes which is causing the error.
Could you please try replacing the two lines of codes with the following:
declare @StartDate datetime = CAST(DATEADD(DAY,-DAY(GETDATE())+1, CAST(GETDATE() AS DATE)) AS DATE)
declare @EndDate datetime = DATEADD(d, 1, EOMONTH(current_timestamp))
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on or upvote button whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators