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.
| Author |
Topic |
|
sql-buzz
Starting Member
7 Posts |
Posted - 2008-07-24 : 17:50:27
|
| Hi,I have a datetime column called StartTime with value such as '2/7/2008 1:02:00 PM'The other column which is called Duration is of int type.how can I add the int values from Duration column to the StartTime column and get the result as a third column called EndTime.For example:StartTime = '2/7/2008 1:02:00 PM'Duration = 20EndTime= '2/7/2008 1:02:20 PM'something like this:select StartTime, Duration, DateAdd(StartTime, Duration) as EndTime from table1;Thanks |
|
|
sql-buzz
Starting Member
7 Posts |
Posted - 2008-07-24 : 18:47:42
|
| Hey huys,i think I got the answer. if anybody has a better solution just let me know..select duration,Startdate, dateadd(second,duration,StartDate) as 'Timetaken'from table1 |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-07-24 : 18:47:43
|
| [code]select StartTime, Duration, DateAdd(ss,Duration,StartTime) as EndTime from table1;[/code]CODO ERGO SUM |
 |
|
|
|
|
|