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)
 date increment

Author  Topic 

nbs
Starting Member

22 Posts

Posted - 2007-04-10 : 12:52:02
Hi,
I have a datetime field.
Everytime I select a record from this field, I need to increment the date by 1 and still keep the time intact. While doing so, I am looking to take into consideration the month end ones.
if i have a 2007-01-31 07:32:31, I want to return 2007-02-01 07:32:31

ideas?

thanks

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-04-10 : 12:56:52
Check out the DateAdd function in books on line. You have different options to add :seconds to months to years..


************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2007-04-10 : 13:33:08
Yes as above this example is to add one day on to current date

dateadd(day,1,getdate())
Go to Top of Page
   

- Advertisement -