What is the maximum size we can give for nvarchar in sqlite?

9.3k views Asked by At

In SqlServer we can use NVarchar(MAX) but this is not possible in sqlite. What is the maximum size I can give for Nvarchar(?)?

2

There are 2 answers

3
finnw On BEST ANSWER

There is no maximum in SQLite. You can insert strings of unlimited length (subject to memory and disk space.) The size in the CREATE TABLE statement is ignored anyway.

0
Shiva On

What is the maximum size I can give for Nvarchar(?)?

You don't, because Sqlite will ignore anything over 255 when specified inside NVARCHAR(?).

Instead, use the TEXT datatype wherever you need NVARCHAR(MAX).

For instance, if you need a very large string column to store Base64 string values for images, you can use something like the following for that column definition.

LogoBase64String TEXT NULL,

SQLite doesn't really enforce length restrictions on length of string.

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.

Source www.sqlite.org/datatype3