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
 General SQL Server Forums
 New to SQL Server Programming
 one week before data

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2008-02-13 : 06:41:43
Dear All,
i've one table, and table will be updating continuously.
i need the data at every week.
select * from my_table where my_datetime_column>=( from one week).

getdate()-1 week.

please guide me in this regard

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-13 : 06:48:11
SELECT *
FROM Table1
WHERE MyDateTimeColumn >= GETDATE() - 7



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-13 : 07:26:00
Also consider

SELECT *
FROM Table1
WHERE MyDateTimeColumn >= DATEADD(day,DATEDIFF(day,0,GETDATE())-7,0)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2008-02-13 : 23:29:41
Thank you very much

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page
   

- Advertisement -