BCP: Unable to resolve column level collations

24,833

Dropping the view and recreating it fixed the problem. Unfortunately this doesn't explain how the problem happened in the first place, or how to prevent it in the future. This isn't a satisfying solution, so if anyone knows a better answer, I'm still very interested in hearing it.

Share:
24,833
user12861
Author by

user12861

Updated on August 07, 2020

Comments

  • user12861
    user12861 almost 4 years

    Running this:

    bcp MyDb.dbo.uvwMyView out "c:\Test.txt" -SMyServer -T -c
    

    I get this error:

    SQLState = S1000, NativeError = 0
    Error = [Microsoft][SQL Native Client]Unable to resolve column level collations 
    

    Searching google finds many possible solutions, none of which work for me or have worked for any of the people they were proposed for. As with other cases posted online, the view causes no problems when I select from it in Management Studio and the results look normal (and have no special characters, I checked). The one text column in the results has collation SQL_Latin1_General_CP1_CS_AS. I have tried several options to bcp with no effect: -w, -CRAW, -COEM, -C850, -C437.

    I'm using SQL Server 2005.

  • user12861
    user12861 over 14 years
    That might not be easy for me, but I might try that, and it might provide useful info (though I doubt it). Unfortunately I won't be able to run the process like that in production no matter what, so it won't help me in the long run, unless it somehow helps track down the real source of the problem.
  • user12861
    user12861 over 14 years
    Good idea with the format file, but unfortunately I get the same error.
  • Damir Sudarevic
    Damir Sudarevic over 14 years
    What does it say for column format (see the xml) when you run this: bcp MyDB.dbo.uvwMyView format null -f c:\FMT_01.xml -x -c -T -t
  • user12861
    user12861 over 14 years
    Annoyingly enough, I get the same error message. That is to say, I can't run the statement you mention. The way I made the format file I used in my previous test was to use an existing format file on a view that is the exact same format (selects from the same tables) and doesn't have this problem.
  • user12861
    user12861 over 12 years
    Interesting, and thanks for adding this, but it wasn't the problem I had. I didn't have any PRINT statements.
  • user12861
    user12861 about 3 years
    It's been 11 years now, and this problem never happened again. How strange.