我在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).