如何将多个xml文件插入SQL Server表?
我设法只使用此脚本获得1个命名文件:
CREATE TABLE #ZSK70 (Name varchar(25) , Value varchar(30),);
INSERT INTO #ZSK70 (Name, Value)
SELECT X.variable.query('Name').value('.', 'varchar(25)'),
X.variable.query('Value').value('.', 'varchar(30)')
FROM (
SELECT CAST(x AS XML)
FROM OPENROWSET(
BULK 'path+filename.xml',
SINGLE_BLOB) AS T(x)
) AS T(x)
CROSS APPLY x.nodes('CollectedData/variable') AS X(variable);
非常感谢任何帮助。