Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 529
JPReddy Avatar asked Jan 30 '11 15:01

JPReddy


2 Answers

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.

like image 170
finnw Avatar answered Oct 16 '22 16:10

finnw


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

like image 1
Shiva Avatar answered Oct 16 '22 17:10

Shiva