Sql server: can i insert $ in the money field

I am inserting values ​​of type ' $5.99' (or trying to insert) into the field money. he doesn't like the dollar sign

I actually do a bulk insert from a csv file. one of the columns in the csv file has moneya dollar sign in it

Could you help me figure out how to make this volumetric insert with a mark $in the box money?

Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 2 (pricepaid).

how can i get rid of the sign?

+3
source share
5 answers

, , -, "" varchar. SQL, . SQL , "$" "" ..

+5

, , varchar . , "$" .

+3

, .

(19,4) .

+2

, - , , . varchar

+2

Others suggested a temporary table. If you use a temporary table to store raw data from your CSV file, you should be able to directly convert to Moneyfrom a field Varcharor Charthat contains the $ character (that is, without deleting it).

This worked for me in SQL 2008.

0
source

Source: https://habr.com/ru/post/1768685/


All Articles