我确实在文件夹中选择了一个文件,谁能帮我选择文件夹中的所有文件进行导入?
SELECT MACHINE = XmlContent.value('(/recordedData/machine)[1]', 'varchar(50)'),
RecordingDate = XmlContent.value('(/recordedData/date)[1]', 'varchar(50)'),
RecordingTime = XmlContent.value('(/recordedData/hour)[1]', 'varchar(50)'),
VariableName = XVar.value('(Name)[1]', 'varchar(50)'),
VariableValue = XVar.value('(Value)[1]', 'varchar(50)')
FROM (
SELECT CAST(XmlContent AS XML)
FROM OPENROWSET(
BULK 'C:\tmp\20130918_0932_ZSK40-2.xml',
SINGLE_BLOB) AS T(XmlContent)
) AS T(XmlContent)
CROSS APPLY
XmlContent.nodes('/recordedData/CollectedData/variable') AS XTbl(XVar)
我认为这应该是文件路径上的一个技巧。感谢帮助!