本文介绍了XML路径中的&#x0D字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在字段中使用以下内容,它正在插入&#amp;#x0D用于回车。如何修复它。
DLTermName = REPLACE(CAST(COALESCE(SUBSTRING((SELECT';'+ RTRIM(ctd.termDiscountName)+':' + dbo.FNRptFormatDiscount(ctd.discMeasureID,ctd.discount,ctd.currencyCode,ctdCurr.symbolPosition,ctdCurr.currencySymbol,@ noDiscountTxt)
+';'+ RTRIM(CAST(CASE WHEN ctdKey.isAuthorized = 0 THEN @ notAuthTxt ELSE RTRIM(REPLACE(ctd.specialConditions,nchar(10),''))END AS nvarchar(3000)))as [text()]
FROM ContractTermDiscount ctd
JOIN货币ctdCurr ON ctd。 currencyCode = ctdCurr.currencyCode
JOIN #contractDiscountStrings cds1 ON ctd.financialQueryID = cds1.queryID
AND cds.marketString = cds1.marketString
WHERE ctdKey.contractID = ctd.contractID AND ctdKey.contractTermID = ctd.contractTermID
AND cds1.carrierString LIKE'%DL%'
ORDER BY ctdKey.contractID,ctdKey.contractTermID,ctd.discountOrder,ctd.termDiscountID
FOR XML PATH(' )),2,8000),'')AS varChar(8000)),';;',';'),
解决方案
I am using the following for a field and it is inserting 
 for carriage return. How to fix it.
DLTermName = REPLACE(CAST(COALESCE(SUBSTRING( ( SELECT ';' + RTRIM(ctd.termDiscountName) + ' : ' + dbo.FNRptFormatDiscount (ctd.discMeasureID, ctd.discount, ctd.currencyCode, ctdCurr.symbolPosition, ctdCurr.currencySymbol, @noDiscountTxt) + ';' + RTRIM(CAST(CASE WHEN ctdKey.isAuthorized = 0 THEN @notAuthTxt ELSE RTRIM(REPLACE(ctd.specialConditions,nchar(10),''))END AS nvarchar(3000))) as [text()] FROM ContractTermDiscount ctd JOIN Currency ctdCurr ON ctd.currencyCode = ctdCurr.currencyCode JOIN #contractDiscountStrings cds1 ON ctd.financialQueryID = cds1.queryID AND cds.marketString = cds1.marketString WHERE ctdKey.contractID = ctd.contractID AND ctdKey.contractTermID = ctd.contractTermID AND cds1.carrierString LIKE '%DL%' ORDER BY ctdKey.contractID, ctdKey.contractTermID,ctd.discountOrder, ctd.termDiscountID FOR XML PATH('')), 2, 8000),'') AS varChar(8000)), ';;', ';') ,
解决方案
这篇关于XML路径中的&#x0D字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!