Error = [Microsoft][ODBC Driver 11 for SQL Server]Warning: BCP import with a format file will convert empty strings in delimited columns to NULL
Asked Answered
H

1

11

I upgraded our Windows Server from 2008 to 2012 and the SQL Server from 2008 to 2014. I have a process that uses the BCP command to export data from the database. The command is below:

bcp "exec db_name.dbo.table_name 20160204, 0" queryout D:\myfolder\201602\20160204\output.txt -c -T -S  SERVER_NAME

Before the upgrade

2016-02-02 04:05:16,038 [2492] INFO  - 
Starting copy...
1000 rows successfully bulk-copied to host-file. Total received: 1000

After the upgrade

2016-02-05 04:04:37,006 [15872] INFO  - 
Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 11 for SQL Server]Warning: BCP import with a format file will convert empty strings in delimited columns to NULL.
1000 rows successfully bulk-copied to host-file. Total received: 1000

Though the output file has been created, the Error/Warning is something that is undesirable in the log. Is there a way to suppress this warning?

Homeric answered 5/2, 2016 at 17:22 Comment(1)
Ugh. What a stupid warning message!Canara
H
11

Apparently,according to Microsoft this is not an error but just a warning and can be safely ignored.(Detailed discussion and work around here)

In my case, I was parsing the BCP console output for string "Error" and reporting that the process failed. Since I am using the Process class of .NET framework to call the BCP command in C# code, I had to add code to check for process exit code 0 and suppress this specific warning.

Homeric answered 5/2, 2016 at 18:9 Comment(1)
Very helpful information. I addressed this by using the following regex when parsing BCP console output: \s+error(?!.*warning:)Perforce

© 2022 - 2024 — McMap. All rights reserved.