English 中文(简体)
BCP: Unable to resolve column level collations
原标题:

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.

最佳回答

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.

问题回答
  • 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.

I know this question is already answered but I ll add my 2 cents... I ran into this today, I had add a PRINT @VarableName and in researching I found this:

From MS Connect

Removing the PRINT fixed my problem.

I was using SQL 2005 tools against a SQL 2008 R2 database, and I got the same error when using datetimeoffset fields.

Try this one:

declare @sql varchar(8000)
select @sql =  bcp "select * from database_name.dbo.table_name" queryout      H:Tempfile_DTU_proc	est1.csv -c -t, -T -S  + @@servername

exec master..xp_cmdshell @sql

I just ran into this issue and found a different solution. Due to a configuration mistake, the server name was not supplied to the BCP command. For sake of redundancy and documentation, this the message: "The error SQLState = S1 000, NativeError = 0 Error = [Microsoft][ODBC Driver 13 for SQL Server]Unable to resolve column level collations BCP copy out failed"

Change the a null server value specified in the Server (-S) parameter to the correct server name.





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签