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)
 how to get next date by adding no

Author  Topic 

imranabdulaziz
Yak Posting Veteran

83 Posts

Posted - 2007-06-07 : 23:17:27
Dear all,
I am using Sql2005 Server.
I want to know how can I find out next date in dd/mm/yyyy format by adding numric number to date . Say suppose I am adding 60 to today date that is 08/06/2007 I should get 06/08/2007.

Is there any way to do it

Please help

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-07 : 23:19:41
[code]select dateadd(day, 60, getdate())[/code]


KH

Go to Top of Page

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-06-07 : 23:25:13
search for 'Date functions' in the SQL server help file, it will give variuos date functions and what are all can be achieved with those.

--------------------------------------------------
S.Ahamed
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-08 : 10:22:03
quote:
Originally posted by imranabdulaziz

Dear all,
I am using Sql2005 Server.
I want to know how can I find out next date in dd/mm/yyyy format by adding numric number to date . Say suppose I am adding 60 to today date that is 08/06/2007 I should get 06/08/2007.

Is there any way to do it

Please help

thanks



You cant make any calculations on the formatted dates
Use proper DATETIME datatype and use dateadd function

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -