1

我有逗号分隔的值。我需要一个查询以插入具有不同行的 SQL Server 2008

Bedford、Bloomfield、Broad Top、Colerain、Cumberland Valley、East Providence、East St. Clair、Harrison、Hopewell、Juniata、Kimmel、King、Liberty、Lincoln、Londonderry、Mann、Monroe、Napier、Snake Spring、Southampton、South Woodbury、 Union, West Providence, West St. Clair, Woodbury,Bedford, Coaldale, Everett, Hopewell, Hyndman, Manns Choice, New Paris, Pleasantville, Rainsburg, St. Clairsville, Saxton, Schellsburg, Woodbury,

4

1 回答 1

1

一种方法:

-- create a table to load the city names into
CREATE TABLE CitiesBulkLoad (CityName VARCHAR(100))

-- load the file into that staging table
BULK INSERT CitiesBulkLoad
FROM 'd:\commacities.txt'  -- replace with **YOUR** file name here!!
WITH
(
   FIELDTERMINATOR = ',',
   ROWTERMINATOR = ','
)
GO

-- now you should have the entries in that staging table 
SELECT * FROM CitiesBulkLoad
于 2012-04-11T07:30:11.990 回答