Это сделает вашу работу. Обязательно замените filePath \ fileName.xml на полный путь к xml и измените / dataroot / CityData (внизу) в соответствии с вашим xml. Также sql должен иметь доступ к файлу.
Declare @xml XML
Select @xml =
CONVERT(XML,bulkcolumn,2) FROM OPENROWSET(BULK 'filePath\fileName.xml',SINGLE_BLOB) AS X
SET ARITHABORT ON
Insert into [YourTableName]
(
City,County,AreaCode,Founded,CityWebSite,[Population],Zipcode,ZipcodeMax
)
Select
P.value('City[1]','VARCHAR(100)') AS City,
P.value('County[1]','VARCHAR(100)') AS County,
P.value('AreaCode[1]','VARCHAR(100)') AS AreaCode,
P.value('Founded[1]','VARCHAR(100)') AS Founded,
P.value('CityWebSite[1]','VARCHAR(100)') AS CityWebSite,
P.value('Population[1]','VARCHAR(100)') AS Population,
P.value('Zipcode[1]','VARCHAR(100)') AS Zipcode,
P.value('ZipcodeMax[1]','VARCHAR(100)') AS ZipcodeMax,
From @xml.nodes('/dataroot/CityData') PropertyFeed(P)