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)
 DATEADD ---is there DATESUBTRACT

Author  Topic 

shebert
Yak Posting Veteran

85 Posts

Posted - 2009-12-11 : 13:39:28
SQL has a built in command called DATEADD which allows me to specify how many month to roll forward from a starting date….
It does not however have a DATESUBTRACT to roll backwards from a starting date…


any ideas how this is accomplished.
Steve

doran_doran
Posting Yak Master

179 Posts

Posted - 2009-12-11 : 13:42:03
just use the "-" minus sign before the number of month
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-12-11 : 13:42:11
you can rollbackwards using negative value like

DATEADD(mm,-5,GETDATE()) will roll 5 months backwards from today
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-12-11 : 13:42:37
Go to Top of Page
   

- Advertisement -