Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. calculating averaqe time from varchar datatype

calculating averaqe time from varchar datatype

Scheduled Pinned Locked Moved Database
databasequestionhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jesse Evans
    wrote on last edited by
    #1

    I hope you can help me... I store an elapsed time value as a string (varchar) (mm:ss) in my SQL database. When I query the data from Excel, how can I calculate an average from this data? Would it help if I made the SQL datatype some kind of time value? Thanks in advance for any advice you may provide. 'til next we type... HAVE FUN!! -- Jesse

    C S 2 Replies Last reply
    0
    • J Jesse Evans

      I hope you can help me... I store an elapsed time value as a string (varchar) (mm:ss) in my SQL database. When I query the data from Excel, how can I calculate an average from this data? Would it help if I made the SQL datatype some kind of time value? Thanks in advance for any advice you may provide. 'til next we type... HAVE FUN!! -- Jesse

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Jesse Evans wrote: When I query the data from Excel, how can I calculate an average from this data? Why are you storing it as a string? I would store it as an integer and if you needed in the format mm:ss a simple calculated field could be created for that function.


      "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar The Second EuroCPian Event will be in Brussels on the 4th of September Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way! My Blog

      1 Reply Last reply
      0
      • J Jesse Evans

        I hope you can help me... I store an elapsed time value as a string (varchar) (mm:ss) in my SQL database. When I query the data from Excel, how can I calculate an average from this data? Would it help if I made the SQL datatype some kind of time value? Thanks in advance for any advice you may provide. 'til next we type... HAVE FUN!! -- Jesse

        S Offline
        S Offline
        syed saba
        wrote on last edited by
        #3

        check this avg(cast(field as int))

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups