質問

I have .csv which content is like this

"aa839","340000","2350444"

When I do the BULK INSERT, I use FIELDTERMINATOR = ',' Thus, the data has quote ".

I want to remove the quote ", so that my database has only aa839, 340000, 2350444.

役に立ちましたか?

解決 3

Dont bother about replacing while doing bulk insert , you can replace later after bulk insert . So do bulk insert as it is originally and later fire update query as below. This is the fastest way too

update table set field= REPLACE(field, 'search', 'replace');

where search is "" and replace is blank

他のヒント

while reading the file replace all (") with blank (), then replace (,) with space ( )

here's how to do it with powershell:

Get-Content inputfilename | 
Foreach-Object {$_ -replace '\"', ''} | 
Set-Content outputfilename
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top