Skip to Content

Solved: How do I create date variable with today’s date and time in MS SQL Server?


I require a date and time variable to be created where the date component is the current date and the time component is 8:00AM.


DECLARE @myDTvariable smalldatetime = DATEADD(HOUR, 8, CAST(CAST(GETDATE() AS date) AS smalldatetime))


    Ads Blocker Image Powered by Code Help Pro

    Ads Blocker Detected!!!

    This site depends on revenue from ad impressions to survive. If you find this site valuable, please consider disabling your ad blocker.