locked
string or binary data would be truncated RRS feed

  • Question

  • User-1634604574 posted

    i have this concat 

    concat(@company_ID_result_new,'' '',@additional_discount_percentage_result_new
    ,'' '',@posting_date_result_new,'' '',@currency_ID_result_new,'' '',@conversion_rate_result_new,'' '',@price_list_currency_ID_result_new,'' ''
    ,@Price_List_Exchange_Rate_result_new,'' '',@base_net_total_result_new,'' '',@base_grand_total_result_new,'' '',@grand_total_result_new,'' ''
    ,@shopify_order_id_result_new,'' '',@customer_ID_result_new,'' '',@customer_name_result_new,'' '',@tax_id_result_new,'' '',@is_pos_result_new,'' ''
    ,@posting_time_result_new,'' '',@Edit_Posting_Date_and_Time_result_new,'' '',@Payment_Due_Date_result_new,'' '',@is_return_result_new,'' '',@address_display_result_new
    ,'' '',@contact_display_result_new,'' '',@shipping_address_result_new,'' '',@ignore_pricing_rule_result_new,'' '',@update_stock_result_new,'' ''
    ,@total_billing_amount_result_new,'' '',@base_total_result_new,'' '',@total_result_new,'' '',@net_total_result_new,'' '',@total_net_weight_result_new
    ,'' '',@base_total_taxes_and_charges_result_new,'' '',@Total_Taxes_and_Charges_Company_Currency_result_new,'' '',@apply_discount_on_result_new,'' ''
    ,@base_discount_amount_result_new,'' '',@base_in_words_result_new,'' '',@discount_amount_result_new,'' '',@base_rounding_adjustment_result_new,'' ''
    ,@base_rounded_total_result_new,'' '',@rounding_adjustment_result_new,'' '',@rounded_total_result_new,'' '',@in_words_result_new,'' '',@total_advance_result_new
    ,'' '',@outstanding_amount_result_new,'' '',@base_paid_amount_result_new,'' '',@paid_amount_result_new,'' '',@base_change_amount_result_new,'' ''
    ,@change_amount_result_new,'' '',@write_off_amount_result_new,'' '',@base_write_off_amount_result_new,'' '',@write_off_outstanding_amount_automatically_result_new
    ,'' '',@Terms_and_Conditions_Details_result_new,'' '',@status_result_new,'' '',@is_opening_result_new,'' '',@c_form_applicable_result_new,'' '',@remarks_result_new
    ,'' '',@commission_rate_result_new,'' '',@total_commission_result_new,'' '',@from_date_result_new,'' '',@to_date_result_new,'' '',@territory_ID_result_new,'' ''
    ,@Account_ID_result_new,'' '',@sales_partner_ID_result_new,'' '',@payment_terms_template_ID_result_new,'' '',@selling_price_list_ID_result_new,'' '',@debit_to_ID_result_new
    ,'' '',@project_ID_result_new,'' '',@pos_profile_ID_result_new,'' '',@amended_from_ID_result_new,'' '',@return_against_ID_result_new,'' '',@shipping_address_name_ID_result_new
    ,'' '',@taxes_and_charges_ID_result_new,'' '',@shipping_rule_ID_result_new,'' '',@account_for_change_amount_ID_result_new,'' '',@write_off_account_ID_result_new,'' ''
    ,@write_off_cost_center_ID_result_new,'' '',@Terms_ID_result_new,'' '',@letter_head_ID_result_new,'' '',@select_print_heading_ID_result_new,'' '',@campaign_ID_result_new
    ,'' '',@source_ID_result_new,'' '',@c_form_no_ID_result_new,'' '',@subscription_ID_result_new,'' '',@language_result_new,'' '',@Customer_Pay_Share_result_new,'' ''
    ,@Insurance_Pay_Share_result_new,'' '',@customer_address_ID_result_new,'' '',@contact_person_ID_result_new,'' '',@company_address_ID_result_new)

    when i execute the query i get this error  string or binary data would be truncated

    Wednesday, June 10, 2020 7:33 AM

All replies

  • User753101303 posted

    Hi,

    It means you try to assign a string which is too long, for example trying to assign 20 characters to a VARCHAR(10). Check what is the maximum length you could get for your concat expression.

    Wednesday, June 10, 2020 8:48 AM
  • User-719153870 posted

    Hi zhyanadil,

    zhyanadil.it@gmail.com

     string or binary data would be truncated

    This error usually occurs when you are trying to insert value to field whose size is smaller.

    I guess you are trying to insert to result of this concat function to some filed while this field's size is not big enough to store it. If this is the case, you can try to increase the size of this filed see if the issue can be fixed. Or if i misunderstood, please share the complete query code.

    In addition, there are obvious syntax errors in your query: concat(@company_ID_result_new,'' '',@additional_discount_percentage_result_new...

    Best Regard,

    Yang Shen

    Wednesday, June 10, 2020 9:08 AM