Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I am facing issue while bulk inserting CSV files in database tables.

What I have tried:

We tried changing the collate in lower environment. But it is uploading it properly.
Posted
Updated 18-May-16 3:27am
v2
Comments
phil.o 17-May-16 7:26am    
Please show the code where you try to assign the decimal value to the database field.
Kornfeld Eliyahu Peter 17-May-16 7:35am    
I think it depends on the computer local and not on the database collation...
You may also try using format-file on BULK INSERT...
Patrice T 17-May-16 19:31pm    
Use Improve question to update your question.

1 solution

Found this on Experts Exchange for BCP.exe (don't know if you use this or the BulkCopy command)
C#
-- You could create a view with the appropriate replacements and bcp from that

 create view v_products
 select 
 ProductID, 
 ProductName, 
 replace(convert(varchar,UnitPrice),'.',',') UnitPrice
 from Northwind.dbo.products


Another option might be to use the -R option:
Quote:
-R
Specifies that currency, date, and time data is bulk copied into SQL Server using the regional format defined for the locale setting of the client computer. By default, regional settings are ignored.

More information here: bcp Utility[^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900