Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Location
    Orlando,FL
    Posts
    35

    Unanswered: Combinding Fields

    Using SQL2005. I have two char fields that I need to combind into one field, but keep getting an error.

    Select
    A.Company,
    B.Sub_Company,
    A.Company + B.Sub_Compnay as 'B_Unit'
    from tableA as A

    left join tableB as B
    on b.key = a.key

    Error I keep getting

    Msg 457, Level 16, State 1, Line 20
    Implicit conversion of char value to char cannot be performed because the collation of the value is unresolved due to a collation conflict.

    Thank you for your help
    David

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    The two columns (A.Company and B.Sub_Company) have different (incompatible) collations, so you can't just concatenate them. You need to either change the collation so they are the same, explicitly specify a compatible collation for one of the two columns, or explicitly specify a common collation for both columns.

    -PatP

  3. #3
    Join Date
    Jul 2007
    Location
    Orlando,FL
    Posts
    35
    Thank you for the info, but how do I specify a compatible collation for one of the two columns, or explicitly specify a common collation for both columns.
    David

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Be forewarned that you need to read up on collations before you make any wild decisions, but you can start with:
    Code:
    SELECT A.Company, B.Sub_Company
    ,  A.Company + B.Sub_Compnay as 'B_Unit'
       FROM tableA as A
       LEFT JOIN tableB as B
          ON (B.key COLLATE SQL_Latin1_General = A.key COLLATE SQL_Latin1_General)
    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •