Reputation: 2426
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.
Upvotes: 6
Views: 34153
Reputation: 131
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.
Upvotes: 0
Reputation: 11
Try this one:
declare @sql varchar(8000)
select @sql = 'bcp "select * from database_name.dbo.table_name" queryout H:\Tempfile_DTU_proc\test1.csv -c -t, -T -S' + @@servername
exec master..xp_cmdshell @sql
Upvotes: 1
Reputation: 7856
I was using SQL 2005 tools against a SQL 2008 R2 database, and I got the same error when using datetimeoffset
fields.
Upvotes: 0
Reputation: 9
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:
Removing the PRINT fixed my problem.
Upvotes: 0
Reputation: 2426
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.
Upvotes: 1
Reputation: 22187
Upvotes: 0