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 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.

- 47,861
- 24
- 143
- 221
-
Thanks for the information. Yes it is accepting any big number. I didn't know that. Thanks. – JPReddy Jan 30 '11 at 16:30
-
2There is, however, a global maximum string/blob length which defaults to 1,000,000,000 bytes (http://www.sqlite.org/limits.html). – dan04 Jan 31 '11 at 05:00
-
On windows phone, using SQL Lite, the max is 4000. If you need bigger, then you can use ntext (though i believe this is being deprecated and may not be in future versions). – Nick Wright Jan 27 '15 at 10:52
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

- 20,575
- 14
- 82
- 112