'Microsoft SQL Server : I need my date to be selected as date, however, I need to append 00:00:00 to start @StartDate and 23:59:59 to at end date

I am declaring Date and I need to keep it as date and not datetime.

DECLARE @StartDate Date = '2022-01-01'

I think set that date to a local date variable.

DECLARE @LocalStartDate Date = @StartDate

I want to be able to add time to the end of @StartDate.

I can't use + '00:00:00' at the end of that declare.

I can do it else where in code but I was wondering if there is a way to do it in this second declare.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source