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 |
|
Arun.G
Yak Posting Veteran
81 Posts |
Posted - 2010-06-25 : 03:43:35
|
| i have two columns which store intime and outtime as datattype time(0)ex:in_time : 09:00:00out_time : 18:30:00now i want to calculate the total_timethe output should be: total_time = 09:30:00how to to it in sqlserver 2008? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-25 : 03:53:17
|
| select convert(varchar(8),cast(in_time as datetime)-out_time,108) from tableMadhivananFailing to plan is Planning to fail |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-06-25 : 03:56:49
|
quote: Originally posted by madhivanan select convert(varchar(8),cast(in_time as datetime)-out_time,108) from tableMadhivananFailing to plan is Planning to fail
shouldn't it be out_time - in_time ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-25 : 04:57:30
|
quote: Originally posted by khtan
quote: Originally posted by madhivanan select convert(varchar(8),cast(in_time as datetime)-out_time,108) from tableMadhivananFailing to plan is Planning to fail
shouldn't it be out_time - in_time ? KH[spoiler]Time is always against us[/spoiler]
Yesselect convert(varchar(8),cast(out_time as datetime)-in_time,108) from tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|