在查询中我使用的是SQL函数(调用.NET函数进行xml转换)
SELECT ApplyXMLTransform((subquery which returns XML type), (subquery which gets the XSLT) FROM SomeTable
当函数ApplyXMLTransform遇到异常时整个查询爆炸...有没有办法防止异常破坏整个记录集(查询明智,我意识到我可以修改函数来处理托管代码中的异常)?
异常本身也是一个神秘故事,因为当我查询作为罪魁祸首的记录时,我看到没有无效的charecters等会构成异常...但这是另一种蠕虫...这里是错误:< / p>
Msg 6522, Level 16, State 1, Line 3
A .NET Framework error occurred during execution of user-defined routine or aggregate "ApplyXsltTransform":
System.Xml.XmlException: Invalid character in the given encoding. Line 21, position 417.
System.Xml.XmlException:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlWriter.WriteNode(XmlReader reader, Boolean defattr)
at System.Data.SqlTypes.SqlXml.CreateMemoryStreamFromXmlReader(XmlReader reader)
at System.Data.SqlTypes.SqlXml..ctor(XmlReader value)
at NF.Sql.Extensions.XSLTTransform.Transform(SqlXml inputDataXML, SqlXml inputTransformXML)
.