TimeSpan compatibility

  • I'm working remotely with a developer who wants to take a SQL value and turn it into a TimeSpan data type (in .NET 4).

    I tried setting the column (from where he's getting the data) to a datetime type, and it doesn't seem to work.

    Does anyone know what SQL data types are compatible with or are convertable to the .NET TimeSpan type?

    Thanks . . .

    Edit: Apparently, unbeknownst to me, he figured it out, so I guess this is no longer an issue. However, if anyone has any suggestions to this for future reference, I'm all ears.

    +--------------------------------------------------------------------------------------+
    Check out my blog at https://pianorayk.wordpress.com/

  • I'm not a .net expert but this link to microsoft's site says it maps to the Time data type available in 2008 and 2008r2

    http://msdn.microsoft.com/en-us/library/ms131092(SQL.100).aspx

    ---------------------------------------------------------------------
    Use Full Links:
    KB Article from Microsoft on how to ask a question on a Forum

  • Trey Staker (10/26/2010)


    I'm not a .net expert but this link to microsoft's site says it maps to the Time data type available in 2008 and 2008r2

    http://msdn.microsoft.com/en-us/library/ms131092(SQL.100).aspx

    Okay, this looks good. I didn't know this was here. I'm definitely bookmarking this for future reference.

    One issue: our testing environment is running SQL 2005. Of course, there's no TIME data type in 2005. I didn't see any TimeSpan equivalent in the 2005 grid. I'd be curious as to how that would work.

    +--------------------------------------------------------------------------------------+
    Check out my blog at https://pianorayk.wordpress.com/

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply