Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 155497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:09:58+00:00 2026-05-11T10:09:58+00:00

I have a time field in a mssql 2008 database that I want to

  • 0

I have a time field in a mssql 2008 database that I want to do something to the effect of:

Timespent = x.sum(x => x.AmountOfTime); 

Where AmountOfTime is a time MSSQL field. Sum seems to only work on decimals, how can I add these columns?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:09:59+00:00Added an answer on May 11, 2026 at 10:09 am

    You probably want to convert the periods to intervals – if necessary, by subtracting the start time from the end time. Note that the TIME type represents an instant, not a duration. In standard SQL, you want INTERVAL HOUR TO SECOND. I’m not sure whether Microsoft supports that – there are other major DBMS that do not. If you are stuck with TIME, you should be able to subtract TIME ’00:00:00′ from the values and get something workable (that would be an INTERVAL).

    One particular advantage of intervals is that you can indeed add them up via SUM.

    For the details, you can manual bash at MSDN (or via Google) as well as I can.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45
I have an UPDATE sql command that modifies a Date/Time field in a particular
I have Database with date field. I see the time like: 1900-01-01 13:38:00.000 How
I want have a field in mysql where the Current time must be auto-generated,
I have a mysql table field set as time type which stores data in
I have a MySQL table where there is a 'date_added' (date) field, 'time_added' (time)
I have a table in SQL Server 2005 which has a date time field.
Every time I have to build a form with a DateTime field I try
I have a table with statistics and a field named time with Unix Timestamps.
i have a nvarchar(max) field named PublishTime, which contains the time in HH:MMtt (10:20AM),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.