CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • Microsoft OLE DB Provider for SQL Server error '80040e57' Difference of two datetime columns caused overflow at runtime.

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    151
  • Date Created
    Thursday, December 15, 2011
  • Last Updated
    Thursday, December 15, 2011
  • This Article Has been Viewed
    2368 times
  • Short Desc
    If you set your datetime column incorrectly for the sql statement that you are trying to use, you will receive this error.
  • Details
    using the DATEDIFF() function, with a datetime stamp, that is incorrectly formatted, will cause the following error.

     

    Microsoft OLE DB Provider for SQL Server error '80040e57'
    Difference of two datetime columns caused overflow at runtime.
    /NewInsert.asp, line 110
  • Recreate Issue
    To recreate this issue.

    In your SQL Server database column
    MyDate = (((1)/(1)/(1900))

  • Resolve Issue
    To correct this issue.

    MyDate = (getdate())

    Using the following code, with the above statement within your SQL Server column, for your datetime Data Type, you should be good to go.

    <%

    sql.commandtext="DATEDIFF(s, MyDate, CONVERT(VARCHAR(26), GETDATE(), 109)) as timestamp"
    %>