NVARCHAR (MAX) in SQLite

I create a table in Sqlite, which contains a column with the maximum length:

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

But the following line was not accepted:

Data nvarchar (max) null

Why?

max is specific to SQL Server (Sybase I think). Just use text:

data text not null

Alternatively, you can use any string data type. SQLite does not enforce a length limit:

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.

(see here).

< /p>

I create a table in Sqlite, which contains a column with the maximum length:

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

But the following line was not accepted:

< /p>

Data nvarchar (max) null

Why?

max is specific to SQL Server (Sybase I think). Just use text:

< pre>data text not null

Alternatively, you can use any string data type. SQLite does not enforce length restrictions:

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.

(see here).

Leave a Comment

Your email address will not be published.