We are excited to announce that the ASP.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Last post Dec 04, 2019 02:42 AM by Yang Shen

• Das.Sandeep

Star

8783 Points

2327 Posts

### How to add timeonly in SQL server

Helo All,

In my database, there are below values, how can I sum and get total value as 9.10 in SQL Server?

Daily log (hours.minutes)

8.00

0.35

0.35

Thanks,

Sandeep

Please let me know if you need more help.

Regards,

Sandeep
• Yang Shen

Contributor

3140 Points

983 Posts

### Re: How to add timeonly in SQL server

Dec 04, 2019 02:42 AM|Yang Shen|LINK

Hi Das.Sandeep,

#### Das.Sandeep

how can I sum and get total value as 9.10 in SQL Server?

I think this is a simple math question. The whole process should be 9.10= 8+1+0.1 = 8 + ((0.35+0.35)/0.6)+((0.35+0.35)%0.6).

```create table #AAA
(
[Daily log] float
)

insert into #AAA values(8.00),(0.35),(0.35)

select (select CONVERT(int,SUM([Daily log])) from #AAA)+SUBSTRING (PARSENAME(SUM([Daily log]),1), 1, 4)/6+cast(SUBSTRING (PARSENAME(SUM([Daily log]),1), 1, 4)%6/10.0 as decimal(38,2)) from #AAA
```

And you will get 9.10.

Best Regard,

Yang Shen