SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 add two date in sql
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

260 Posts

Posted - 11/01/2010 :  01:51:23  Show Profile  Reply with Quote
how to add two date in select query in sql

select date1 + date2 from tbl

Starting Member

30 Posts

Posted - 11/01/2010 :  02:17:40  Show Profile  Reply with Quote
Assuming date1 and date2 are columns of a table and of same datatype.

select date1 + date2 from <table> where <condition>

Nipun Chawla
Go to Top of Page

Aged Yak Warrior

843 Posts

Posted - 11/01/2010 :  02:55:38  Show Profile  Reply with Quote
What is the significance to add two dates ?

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

Patron Saint of Lost Yaks

30407 Posts

Posted - 11/01/2010 :  04:47:57  Show Profile  Visit SwePeso's Homepage  Reply with Quote
What is your expected result of adding '20100101' and '20090101'?
Are you trying to accomplish something else, like getting an average of two dates?

N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000