July 21, 2009 at 5:42 am
Hi all
How to get last 5 days back date
July 21, 2009 at 6:06 am
Not sure I understand what you want.
If you want the date of 5 days ago, this will get it. If you want something else, please explain further what it is that you want.
DECLARE @CurrentDateWithoutTime DATETIME
SET @CurrentDateWithoutTime = DATEADD(dd,DATEDIFF(dd,0,getdate()),0)
SELECT DATEADD(dd,-5,@CurrentDateWithoutTime) AS FiveDaysAgo
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 21, 2009 at 7:11 am
sad thing is I know I will never get the last 5 days back................:-)
---------------------------------------------------------------------
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply