Reading csv files and importing data into SQL Server -


i'm reading numbers .csv file sql server below statement, assuming i've created linked server named csv_import.

select *  csv_import...sophos#csv 

however, problem if have comma numbers data, show null instead of correct one. how can read "54,375" correctly sql server? thank help.

below data in csv file.

09/07/2017,52029,70813,10898,6691,6849,122,25,147427 09/08/2017,47165,61253,6840,5949,5517,75,2,126801 09/14/2017,"54,375","16944","15616","2592","3280",380,25,"96390" 

this result statement:

2017-09-07 00:00:00.000 52029   70813   10898   6691    6849    122 25  147427 2017-09-08 00:00:00.000 47165   61253   6840    5949    5517    75  2   126801 2017-09-14 00:00:00.000 null    16944   15616   2592    3280    380 25  96390 

one way go using temporary table. read data text, replace every comma in whole table dot (.), if want decimal separator, or empty string('') if it's thousand separator, load data exisitng table converting (you don't have explicitly, sql implictly).


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -