我正在尝试用中文字符更新标签的值。但是它不添加中文字符。相反,它添加了“???” . 例如 update table set col.modify('replace value of (/tag/text())[1] with "我"') where .. 非常感谢任何帮助
谢谢本
我正在尝试用中文字符更新标签的值。但是它不添加中文字符。相反,它添加了“???” . 例如 update table set col.modify('replace value of (/tag/text())[1] with "我"') where .. 非常感谢任何帮助
谢谢本
对于像这样的国际字符,您通常希望使用 N'this is my data' 来表示它是 unicode/nchar。否则它被视为 char,我假设 db 排序规则不支持您提交的字符。试着做
select 'my chars'
看看你是否仍然得到问号,我会假设是这样。
编辑 - 这是一个证实我的建议有效的例子:
declare @x xml
set @x = N'<tag>abc</tag>'
set @x.modify (N'replace value of (/tag/text())[1] with "我"')
select @x
我在选择xml时看到了该符号,并且我验证了该字符之前和之后是0x1162(证明数据是完整的)。
你在使用 unicode 字符串吗?那些以大写 N 开头,例如:
update yourtable
set yourvalue = N'your chinese characters'
where id = yourid