我有一个包含 ntext 数据类型的 XML 列的表.
I have a table include XML column with ntext data type.
CREATE TABLE #Testing
(
Id int identity,
content ntext
)
INSERT INTO #Testing
VALUES (N'<?xml version="1.0" encoding="UTF-8"?>
<Data <BankAcc><Bankname value="TEST Qərib Bank "/><AccNum value="TEST1221"/></BankAcc>
</Data>')
我想将此数据 插入到现有的ntext 数据类型xml 列中,代码如下
I want to insert this data <Owner value="Qərib"/> into existing ntext data type xml column with code below
update #Testing
set content.modify(N'insert <Owner value="Qərib"/> into (/Data)[1]')
但我收到一个错误:
消息 258,级别 15,状态 1,第 12 行
无法在 ntext 上调用方法
Msg 258, Level 15, State 1, Line 12
Cannot call methods on ntext
所以我尝试使用演员
update #Testing
set cast(content as varchar(max)).modify(N'insert <Owner value="Qərib"/> into (/Data)[1]')
然后我收到此错误消息:
then I got this error message:
消息 102,级别 15,状态 1,第 12 行
'(' 附近的语法不正确.
Msg 102, Level 15, State 1, Line 12
Incorrect syntax near '('.
有什么解决办法吗?
将您的数据类型转换为 nvarchar(max)、varchar(max) 或 varbinary(max)
convert your data type to nvarchar(max), varchar(max) or varbinary(max)
重要!ntext、text 和 image 数据类型将在 SQL Server 的未来版本中删除.避免在新的开发工作中使用这些数据类型,并计划修改当前使用它们的应用程序.请改用 nvarchar(max)、varchar(max) 和 varbinary(max).
IMPORTANT! ntext, text, and image data types will be removed in a future version of SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead.
参考
如果它是正确的 xml,那么 XML 数据类型将最适合
If it is proper xml then XML data type will fit best
这篇关于将数据插入到 ntext xml 列(无法调用 ntext 错误的方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
修改现有小数位信息Modify Existing decimal places info(修改现有小数位信息)
多次指定相关名称“CONVERT"The correlation name #39;CONVERT#39; is specified multiple times(多次指定相关名称“CONVERT)
T-SQL 左连接不返回空列T-SQL left join not returning null columns(T-SQL 左连接不返回空列)
从逗号或管道运算符字符串中删除重复项remove duplicates from comma or pipeline operator string(从逗号或管道运算符字符串中删除重复项)
将迭代查询更改为基于关系集的查询Change an iterative query to a relational set-based query(将迭代查询更改为基于关系集的查询)
将零连接到 sql server 选择值仍然显示 4 位而不是concatenate a zero onto sql server select value shows 4 digits still and not 5(将零连接到 sql server 选择值仍然显示 4 位而不是 5)