sql - 如何在SQL Server CE中插入超过4000个字符的nvarchar数据类型?

标签 sql sql-server-ce nvarchar

我将超过 4000 个字符的字符串插入到 nvarchar 列中,因此 SQL Server CE 抛出错误。

我知道ntext可以存储超过4000个字符,但将来几乎支持。

如何将超过 4000 个字符的字符串插入到 nvarchar 列中,以便 SQL Server CE ?

最佳答案

不幸的是data type options are limited in SQL CE 。您需要使用 ntext 来支持超过 4000 个字符。

note: ntext is no longer supported in string functions.

除非使用 is nulllike,否则您将无法对 ntext 进行比较或排序。

The ntext and image data types cannot be used in WHERE, HAVING, GROUP BY, ON, or IN clauses, except when these data types are used with the LIKE or IS NULL predicates

只要您不尝试比较 ntext 的值,您就可以使用 ntext 进行选择、更新、删除、插入 code> 列,但 is nulllike 除外。

所以你不能:

update t 
set ntxt = 'I miss nvarchar(max)' 
where ntxt = 'I am using sql ce'

但是你可以

update t 
set ntxt = 'I miss nvarchar(max)' 
where ntxt like '%sql ce'

关于sql - 如何在SQL Server CE中插入超过4000个字符的nvarchar数据类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42874614/

相关文章:

SQL检查组是否包含NULL

c# - 在 SQL CE 数据库上的 Entity Framework 中使用 DateDiff

c# - WP7 Linq To SQL(SQL CE)IDataErrorInfo

string - List<string> 的 linq 查询语法

sql-server - 从 sql server 迁移到 Oracle varchar 长度问题

sql-server - 什么时候 nvarchar(Max) = nvarchar(4000)?

mysql - wp_usermeta 查询在加载前挂起几秒钟

sql - 从 FOR XML Sql 查询中解码文本

mysql - SQL按最大列排序和内连接多个表

git - 如何使用 Visual Studio Tools for Git 将跟踪文件移动到未跟踪文件