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 2000 Forums
 Transact-SQL (2000)
 formatting date and adding months

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-12-13 : 08:21:44
Robert writes "Within an stored procedure I would like to select a date from a table and then add a specified number of months (determined by a field in the same table). I have it pulling the date in the native format yyyy/mm/dd time.

Thanks
Robert"

RM
Yak Posting Veteran

65 Posts

Posted - 2004-12-13 : 08:29:42
You can use DATEADD ( datepart , number, date )
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-12-13 : 11:07:57
Just to expand on RM's reply:

SELECT DATEADD(Month, AddOnMonthsColumn, OriginalDateColumn)
FROM MyTable

Kristen
Go to Top of Page
   

- Advertisement -