我有一系列csv文件,有些人会使用双引号。我正在关注techbrothers IT的guidacne:http://www.techbrothersit.com/2016/03/how-to-create-tables-dynamically-from.html
我有多个文件,每个文件都有唯一的模式,未来的文件也是唯一的。 (我没有使用数据流任务的原因。
这是我正在解析的行:
3921773,"FNAME","LNAME","123 Anywhere St","CTY",NY,12020,43.023721,-73.804807,1,rooftop,195,"Old Post Rd","Ballston Spa",NY,"Saratoga County",12020,US,"Office, Geographic Office (GIO)"
使用的代码:
query = "Insert into " + SchemaName + ".[" + TableName + "] (" + ColumnList + ") ";
query += "VALUES('" + line.Replace(FileDelimiter, "','") + "')";
生成的插入内容:
Insert into dbo.[tbl] ([pk],[fname],[lname],[addr1],[pcity],[pstate],[pzip],[Lat],[Long],[AccScore],[Type],[Number],[Street],[City],[State],[County],[Zip],[Country],[Source])
VALUES('3921773','"FNAME"','"LNAME"','"123 ANYWHERE ST"','"CTY"','NY','12020','43.023721','-73.804807','1','rooftop','195','"Old Post Rd"','"Ballston Spa"','NY','"Saratoga County"','12020','US','"Office','Geographic Information Officer (GIO)"')
问题是最后一个字段。因为它是一个双引号(“)字段,它内部的逗号被拾取,并被添加为插入查询中的附加数据字段。如何计算引号?
由于