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)
 Check Date

Author  Topic 

vivo
Starting Member

24 Posts

Posted - 2010-03-16 : 22:17:04
How to check
Datecreated > (Current Date – 1 month and 15 days)

Thanks

namman
Constraint Violating Yak Guru

285 Posts

Posted - 2010-03-16 : 22:38:33
Using dateadd

example:

select GETDATE() as CurrentDate, dateadd(d, -15, dateadd(m, -1, GETDATE())) as Monthand15DaysEarlier
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-17 : 01:34:33
select GETDATE() as CurrentDate, dateadd(d, -15, dateadd(m,DATEDIFF(m,0,GETDATE())-1,0)) as Monthand15DaysEarlier

if you need to consider absolute day

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -