1 Reply Latest reply on Apr 28, 2006 2:00 PM by philh

    String or binary data would be truncated

    mpaulopes Level 1
      Here is my query

      <cfif isdefined('session.freegift')>
      <cfquery datasource="#DSN#" name="get_BBcoupon">
      Select *
      From Products
      Where ProductItemNumber = '#session.freegift#'
      </cfquery>

      <cfquery username="#db_username#" password="#db_password#" datasource="#DSN#" name="insertfreegift">
      INSERT INTO OrderItems (
      OrderItemOrderNumber,
      OrderItemProductItemNumber,
      OrderItemProductAttrib,
      OrderItemProductAttribPrice,
      OrderItemProductAttrib2,
      OrderItemProductAttrib2Price,
      OrderItemProductPrice,
      OrderItemQuantity,
      OrderItemHandlingPrice,
      OrderItemHandlingPrice2,
      OrderItemTotal,
      cftoke, cfid,
      Inventory_status)

      VALUES (
      #orderNumber#,
      '#get_BBcoupon.ProductItemNumber#',
      '#get_BBcoupon.ProductName#',
      0,
      '',
      0,
      0,
      1,
      0,
      0,
      0,
      '#CFTOKEN#',
      <cfif isnumeric(cfid)>#cfid#<cfelse>0</cfif>,
      '1')
      </cfquery>
      </cfif>

      I throws a error on CFID..... if I comment CFID the error goes to CFTOKEN if I comment CFTOKEN it goes to get_BBcoupon.ProductName so on and so on. and here is the error:

      Error Executing Database Query.
      [Macromedia][SQLServer JDBC Driver][SQLServer]String or binary data would be truncated.