看起来这只是一个需要修复的小语法错误(见下文):
SELECT t.e.value('@DTS:DTSID','varchar(100)') AS DTSID,
t.e.value('@DTS:ObjectName','varchar(100)') AS ObjectName,
ex.st.value('@DTS:refId','varchar(max)') AS StepID,
ex.st.value('@DTS:ObjectName','varchar(max)') AS StepName,
ex.st.value('@DTS:Description','varchar(max)') AS StepDesc,
cx.cn.value('@connectionManagerRefId[1]','varchar(max)') AS StepConn
FROM #SSISPackagesList PackageXML
CROSS APPLY PackageXMLContent.nodes('DTS:Executable') t(e)
OUTER APPLY t.e.nodes('DTS:Executables/DTS:Executable') AS ex(st) --Control flow steps
OUTER APPLY ex.st.nodes('DTS:ObjectData/pipeline/components/component/connections/connection') cx(cn)
属性名前面需要一个“@”。