DECLARE @TheDate DATETIME
SET @TheDate = '2008-02-05 23:59:59.997'
SELECT @TheDate
SELECT CAST(CAST(@TheDate-0.5000000385803 AS INT) AS DATETIME)
SET @TheDate = '2008-02-05 00:00:00.000'
SELECT CAST(CAST(@TheDate-0.5000000385803 AS INT) AS DATETIME)
๐
We're still on 2K, could be decades before we see 2K8 :sick:
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden