I am using BCP to import a quoted CSV file into the database.
The table is correctly defined (IMO) as a mix of NVARCHAR and NUMERIC fields. Some of the numeric fields have decimals (100.1).
Sample CSV line
"007091901713","010288367-001","7093900093","010288367-001","TBayTel","CELL","877.5","832.5","877.5",,"5","DOG LAKE","ON","48.674680556","-89.556313889","457","47","B8",,"60","I","5M00D7WFC","75","Kathrein 80010692V01","47","320","3","12","N","1.8","N",,"2016-11-18"
Error
#@ Row 1, Column 7: Invalid character value for cast specification @#
"007091901713" "010288387-001" "7093900093" "010288387-001" "TBayTel" "CELL" "877.5" "832.5" "877.5" <NULL> "5" "MONTREAL RIVER" "ON" "47.2472" "-84.5983" "529" "87" "B8" <NULL> "60" "I" "5M00D7WFC" "A7" "EMSRR801200DA2" "87" "222" "0" "12" "N" "1.9" "N" <NULL> "2016-11-18"
Column 7 is the value of "877.5" which is defined in the table as a NUMERIC(16,8)
which I believe should accept the value - its within bounds. And if I do a normal SQL insert statement with copying and reformatting the CSV line it does work. I've tried using both regular BCP commands as well as having a format file (I created a format file based on the table).
bcp "dbo.table" in "full-extract.csv" -U "$adminSqlLogin" -P "$password" -S $serverNameFQDN -d $databaseName -f full_extract.bcp.fmt -e "./error-full.log" -a 65535 -b 10000