如何在返回XML值的SQL select语句周围加上引号? [英] How do I put quotes around a SQL select statement that returns XML value?
本文介绍了如何在返回XML值的SQL select语句周围加上引号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法在sql中的以下字符串值select语句中添加引号。我该怎么办?
I am having trouble putting quotes around the following string value select statement in sql. How do I do it?
Convert(Xml, OM.Body).value('(//DocumentResponseMessage/ecf:Document/ecf:DocumentMetadata/d:RegisterActionDescriptionText)[1]','varchar(250)') AS 'CaseEventDescription',
我需要这样做的原因是因为值中有逗号,当我将输出放在Excel中时,它不适合一列。所以引用引号会有所帮助,但我不知道该怎么做。
请帮忙。
我的尝试:
The reason I need to do that is because the value has a comma in it and when I put the output in Excel, it is not fitting in one column. So putting quotes will help but I don't know exactly how to do it.
Kindly help.
What I have tried:
I am having trouble putting quotes around the following string value select statement in sql. How do I do it?
Convert(Xml, OM.Body).value('(//DocumentResponseMessage/ecf:Document/ecf:DocumentMetadata/d:RegisterActionDescriptionText)[1]','varchar(250)') AS 'CaseEventDescription',
The reason I need to do that is because the value has a comma in it and when I put the output in Excel, it is not fitting in one column. So putting quotes will help but I don't know exactly how to do it.
Kindly help.
推荐答案
尝试
try
'''' +
Convert(Xml, OM.Body).value('(//DocumentResponseMessage/ecf:Document/ecf:DocumentMetadata/d:RegisterActionDescriptionText)[1]','varchar(250)')
+ '''' AS 'CaseEventDescription'
这篇关于如何在返回XML值的SQL select语句周围加上引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文