不能在“插入”和“删除”表中使用 text、ntext 或 image 列。
这种情况下应该采取什么解决方法? :(
最佳答案
从 SQL Server 2005 开始,TEXT/NTEXT/IMAGE
已弃用 - 您应该使用 (N)VARCHAR(MAX)
和 VARBINARY(MAX)
数据类型。
(N)VARCHAR(MAX)(请参阅 MSDN docs here )和 VARBINARY(MAX) 允许最多 2 GB 的数据
来自 MSDN 文档:
nvarchar [ ( n | max ) ]
Variable-length Unicode character data. n can be a value from 1 through 4,000. max indicates that the maximum storage size is 2^31-1 bytes. (= 2 GB)
(N)VARCHAR(MAX) 类型还允许所有常用的 T-SQL 字符串函数对其进行处理 - 而 (N)TEXT 则完全不是这样。
如这个MSDN article shows ,触发器也支持替换类型:
SQL Server 2008 does not allow for text, ntext, or image column references in the inserted and deleted tables for AFTER triggers. However, these data types are included for backward compatibility purposes only. The preferred storage for large data is to use the varchar(max), nvarchar(max), and varbinary(max) data types. Both AFTER and INSTEAD OF triggers support varchar(max), nvarchar(max), and varbinary(max) data in the inserted and deleted tables.
关于sql-server - 如何使用 'inserted' 和 'deleted' 表中的 text、ntext 或 image 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1935691/