Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to go back in 2006-05-08

Author  Topic 

SCHEMA
Posting Yak Master

192 Posts

Posted - 2008-07-22 : 13:13:24
How i can go backup in this date from current one:

2005-05-08 from getdate()?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-22 : 13:16:21
DATEADD(dd,(-1) * DATEDIFF(dd,'2005-05-08',getdate()),getdate())
Go to Top of Page

SCHEMA
Posting Yak Master

192 Posts

Posted - 2008-07-22 : 13:19:16
Thanks.

I want to go 2005-05-08 00:00:01
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-22 : 13:21:54
quote:
Originally posted by SCHEMA

Thanks.

I want to go 2005-05-08 00:00:01


just add a sec to query above
select dateadd(ss,1,DATEADD(dd,(-1) * DATEDIFF(dd,'2005-05-08',getdate()),getdate()))
didnt get your scenario though. can you explain?
Go to Top of Page

SCHEMA
Posting Yak Master

192 Posts

Posted - 2008-07-22 : 13:23:49

Didn't get result?
I want to go back to 2005-05-08 00:00:01 (starting from that date)
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-07-22 : 13:27:57
You are very unclear in your request, do you just want
SELECT *
FROM yourTable
WHERE aDateColumn BETWEEN '05/08/2005' and getdate()?

Jim
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-22 : 13:32:59
please post some sample data and show what you want out of them.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-07-22 : 13:49:00
Yeah, what do you mean by "I want to go back to..."?

I would like to go back as well, there are several "if I only knew then what I know now" potential conquests that I would like another crack at

Be One with the Optimizer
TG
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2008-07-22 : 14:05:47
I think he needs all the dates starting from 2005-05-08 to today
Go to Top of Page
   

- Advertisement -