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 add the date in sqlserver

Author  Topic 

Ambikaa
Starting Member

43 Posts

Posted - 2008-08-23 : 01:33:47


Hi,

I have 3 plans like 30days, 60 and 90 days, if the user chooses the 30 days plan by today then the plan expiration date should be calculated with 30 dasys. through code i can do, is there any possibility to do in query?


for eg

user chooses 30 days plan

today date 23/08/2008

plan expire date 21/09/2008

help me

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-23 : 01:37:33
yup. use DATEADD()

SELECT DATEADD(d,DATEDIFF(d,0,GETDATE())+@Plan,0) AS ExpirationDate
Go to Top of Page
   

- Advertisement -