替换表中所有列中的XML字符 [英] Replacing XML Character in all the columns in a table
问题描述
  Hello T-SQL大师,
Hello T-SQL gurus, 我想替换表中所有列中的所有xml字符,请不要注意使用列名我的查询 。以下是我的查询。我收到的错误如下。 I want to replace all the xml characters in all the columns in a table, please not i can note use column name in my query . Below is my query. And i am recieving the error as below.
I appreciate the help in advance!
没有像"xml字符"这样的东西。 0x001F是0x1F的Unicode版本,即所谓的单位分隔符。它是不可打印的空白字符之一。它无法隐式转换,因此您需要执行错误消息 你总能这样做,我大多数情况下这只是一个不好的做法。在某些情况下,它表示数据建模问题。有时它告诉你,你正在尝试做一些应该在前端完成的事情。 You always can do, I most cases it's only a bad practice. In some cases it indicates data modeling issues. And sometimes it tells you that you're trying to do something which should be done in the front-end. 这篇关于替换表中所有列中的XML字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
Msg 6841,Level 16,State 1,Line 20
FOR XML无法序列化数据节点'notes',因为它包含XML中不允许的字符(0x001F)。要使用FOR XML检索此数据,请将其转换为二进制,varbinary或图像数据类型,并使用BINARY BASE64指令。
Msg 6841, Level 16, State 1, Line 20
FOR XML could not serialize the data for node 'notes' because it contains a character (0x001F) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.SELECT * FROM [TableName] as t FOR XML RAW, TYPE
我提前感谢您的帮助!
推荐答案
告诉您:将包含此字符的列转换为[VAR] BINARY(MAX)并使用
BINARY BASE 64选项。
我可以注意到在我的查询中使用列名
i can note use column name in my query