Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NVARCHAR (MAX) in Sqlite

I am creating a table in Sqlite with a column with max length:

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

But the following line is not being accepted:

Data nvarchar (max) null

Why?

like image 986
Miguel Moura Avatar asked May 23 '17 21:05

Miguel Moura


1 Answers

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

data text not null

or, you can really use any character string data type. SQLite doesn't 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).

like image 161
Gordon Linoff Avatar answered Sep 28 '22 00:09

Gordon Linoff