Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 857
nobody Avatar asked Feb 05 '16 17:02

nobody


1 Answers

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.

like image 150
nobody Avatar answered Oct 13 '22 07:10

nobody