tags:

views:

472

answers:

2

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.

A: 
  • You may try to remote connect to the server and run the bcp without the -s option from there.
  • If the server collation is different from the database or column collation, try to create the format file and explicitly specify it in the bcp.
Damir Sudarevic
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.
Good idea with the format file, but unfortunately I get the same error.
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
Damir Sudarevic
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.
A: 

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.