SQL Server bcp Utility and the Numeric Data Type

In response to a recent customer request, we have produced a custom build of the SQL Server ODBC driver, which alters how our bulk copy tool behaves with regards to numeric columns. With the custom build, if you try to insert a number that will not fit into the target column, the bcp utility will insert the value zero.

The following commands demonstrate the new behaviour:

$ cd /usr/local/easysoft
$ ./unixODBC/bin/isql.sh -v SQLSERVER_SAMPLE myuser mypassword
SQL> USE mydb
SQL> CREATE TABLE mytable (mycol numeric(7,7))
$ more ~/Documents/myvalues
7.2e-10
7e-10
0.0000000000000000000000000072
$ ./sqlserver/bcp/bcp mydb.dbo.mytable in ~/Documents/myvalues -S mymachine\\myinstance -U myuser -c
$ ./unixODBC/bin/isql.sh -v SQLSERVER_SAMPLE myuser mypassword
SQL> USE mydb
SQL> select * from mytable
+----------+
| mycol    |
+----------+
| 0.0000000|
| 0.0000000|
| 0.0000000|
+----------+

If you would like this version of bcp, please contact our Support team ().