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
 i need alogic

Author  Topic 

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-13 : 05:59:56
i need before 7 days from sysdate
and before 15 days from sys date
befrore one month from sysdate

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-13 : 06:11:38
Duplicate post
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=102725



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

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-05-13 : 06:24:39
hi
try this

SELECT DATEADD(day,-7,GETDATE())
SELECT DATEADD(month,-1,GETDATE())

ok tanx..
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-13 : 06:37:48
quote:
Originally posted by soorajtnpki

hi
try this

SELECT DATEADD(day,-7,GETDATE())
SELECT DATEADD(month,-1,GETDATE())

ok tanx..



That includes time part and may not give correct answer if time is stored in the column.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-05-13 : 06:41:15
ok
then wat will be the solution??

ok tanx
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-13 : 06:43:44
For that we need to know whether OP stores time part in the table and is it important for calculating date difference.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-13 : 07:04:39
thnks harsh
Go to Top of Page
   

- Advertisement -