Sqlite中的NVARCHAR(MAX)

前端之家收集整理的这篇文章主要介绍了Sqlite中的NVARCHAR(MAX)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在sqlite中创建一个表,其中包含一个最大长度的列:

create table [Log] (
    Id int identity not null
        constraint PK_Log_Id primary key,Data nvarchar (max) null
)

但以下行未被接受:

Data nvarchar (max) null

为什么?

解决方法

max特定于sql Server(我认为是Sybase).只需使用文字

data text not null

或者,您可以使用任何字符串数据类型. sqlite不强制实施长度限制:

Note that numeric arguments in parentheses that following the type
name (ex: “VARCHAR(255)”) are ignored by sqlite – sqlite does not
impose any length restrictions (other than the large global
sqlITE_MAX_LENGTH limit) on the length of strings,BLOBs or numeric
values.

(见here).

猜你在找的Sqlite相关文章