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 '80004005' The precision is invalid.

  • 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:
    110
  • Date Created
    Friday, February 25, 2011
  • Last Updated
    Wednesday, June 20, 2012
  • This Article Has been Viewed
    2265 times
  • Short Desc
    When inserting data to a Decimal Column within SQL Server, you may encounter this error. Microsoft OLE DB Provider for SQL Server error '80004005'
  • Details
    This error will happen when you are trying to insert data into a SQL Server Column with data of type Decimal.
    When you write your Parameter out using the adDecimal this error will accure.

     
    Microsoft OLE DB Provider for SQL Server error '80004005'
    The precision is invalid.
    /insert.asp, line 30
  • Recreate Issue
    To recreate this issue.

    <%
    MyNum = "5.50"
    sqlUser.Parameters.Append sqlUser.CreateParameter("@evUsername", adDecimal, adParamInput, 25, MyNum)
    %>
  • Resolve Issue
    To resolve this issue.
    This is a work around to insert the Decimal values into your SQL Server Decinal Column.

    <%
    MyNum = "5.50"
    sqlUser.Parameters.Append sqlUser.CreateParameter("@evUsername", adVarChar, adParamInput, 25, MyNum)
    %>


    In the above code, we are substituting the adDecimal with adVarChar
    This will allow for the Decimal number 5.50 to be inserted into our SQL Server Decimal Column.
    Keep the column withing SQL Server as a Data type Decimal, that does not change.
    This is only a work around, information on how to properly use the Decimal within SQL Server and your ASP Classic VBScript will be provided in a future update to this Article.