Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sql server: can i insert a $ into a money field

i am inserting values like '$5.99' (or trying to insert) into a money field. it doesnt like the dollars sign

i am actually doing a bulk insert from a csv file. one of the columns in the csv file has money in it with a dollar sign

can you please help me figure out how to do this bulk insert with the $ sign into a money field?

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 do i get rid of the sign?

like image 728
Alex Gordon Avatar asked Sep 02 '25 16:09

Alex Gordon


1 Answers

Based on this question, as well as your earlier questions here and here, I'd recommend that you do your bulk insert into a temporary holding table, where you could define your "money" field as a varchar. Then write another SQL statement to move the data from the holding table to the real table. In this SQL statement, you could skip unwanted columns, remove the '$' from your "money" field and cast it as a money data type, etc.

like image 131
Joe Stefanelli Avatar answered Sep 05 '25 07:09

Joe Stefanelli