sqlserver
sqlite

Migrate SQL Server to SQLite

Certified — live-tested path

The converter maps 21 SQL Server column types to SQLite. 7 of them change kind on the way (BIT becomes INTEGER, DATE becomes TEXT, DATETIME becomes TEXT, and more); the table below lists every one. DBShifts converts the schema, copies the rows in parallel batches and checks the result with row counts and checksums.

Start SQL Server → SQLite Migration

Free tier · no credit card

SQL Server vs SQLite

sqlserver

SQL Server

Microsoft's enterprise relational database.

sqlite

SQLite

the embedded database that ships inside everything.

SQL Server to SQLite data type mapping

Pulled directly from DBShifts's own conversion rules — not a general reference table, this is what actually runs.

SQL ServerSQLite
INT / BIGINTINTEGER
TINYINTINTEGER
DECIMAL(p,s) / MONEYNUMERIC
VARCHAR / NVARCHAR(n)TEXT
NVARCHAR(MAX)TEXT
DATETIME / DATETIME2TEXT
UNIQUEIDENTIFIERTEXT
BITINTEGER
VARBINARY / IMAGEBLOB
IDENTITYINTEGER PRIMARY KEY AUTOINCREMENT

Example: SQL Server to SQLite schema conversion

SQL Server

CREATE TABLE users (
  id INT IDENTITY(1,1) PRIMARY KEY,
  name NVARCHAR(255) NOT NULL,
  is_active BIT DEFAULT 1,
  created_at DATETIME2 DEFAULT SYSUTCDATETIME()
);

SQLite

CREATE TABLE "users" (
  "id" INTEGER PRIMARY KEY AUTOINCREMENT,
  "name" TEXT NOT NULL,
  "is_active" INTEGER DEFAULT 1,
  "created_at" TEXT DEFAULT CURRENT_TIMESTAMP
);

What SQL Server features have no SQLite equivalent

SQLite has no stored procedures, no functions, no triggers with procedural bodies, and no schemas. A SQL Server database that keeps business logic in T-SQL does not have a destination for that logic, and no converter can invent one. This is the single biggest decision on this route: the logic either moves into the application or the migration is only moving tables.

There are no separate schemas either. Everything in SQL Server under dbo, sales and staging lands in one flat namespace, so two tables that differ only by schema will collide. Names have to be flattened deliberately, usually by prefixing, before the conversion runs.

IDENTITY becomes INTEGER PRIMARY KEY AUTOINCREMENT, but only for a single-column integer key. A composite primary key that included an IDENTITY column cannot keep the auto-increment behaviour, because SQLite ties AUTOINCREMENT to the rowid.

Type affinity means SQLite will accept the wrong data quietly

SQLite does not enforce column types. A column declared INTEGER will store the string 'banana' without complaint, because the declared type is an affinity rather than a constraint. Every SQL Server type conversion on this page therefore describes intent, not enforcement.

In practice this matters most for DECIMAL. SQL Server DECIMAL(10,2) becomes NUMERIC, and SQLite stores it as an 8-byte float unless the value is an exact integer. Money that was exact in SQL Server can come back with a rounding tail. If financial values are involved, store them as integer minor units before the move and convert on read.

DATETIME2 becomes TEXT. That is the correct choice, because SQLite has no date type at all and ISO-8601 text sorts and compares correctly. Any application code doing date arithmetic in T-SQL needs rewriting against SQLite's date functions.

Why people move SQL Server to SQLite

The usual reason is not replacing the production database. It is producing something portable: an offline copy for a desktop or mobile client, a fixture for a test suite that must run without a server, or an analysis snapshot someone can open without credentials. SQLite is a single file, which is the whole appeal.

That shapes what correctness means here. A test fixture needs the schema and the relationships intact more than it needs every constraint enforced, and an offline copy usually wants a subset rather than the whole database. Both are better served by a filtered, masked extract than by a full copy of production.

SQL Server → SQLite conversion notes

Engine-specific rules baked into the conversion and transfer pipeline — verified by live certification of this exact pair.

  • TINYINT is unsigned (0–255) in SQL Server — DBShifts widens it on signed targets so 128–255 don't clip.
  • UNIQUEIDENTIFIER, DATETIMEOFFSET, MONEY and NVARCHAR(MAX) all have explicit conversion rules per target.
  • Wrapped defaults like ((1)) and (N'foo') are unwrapped to portable literals.
  • High-precision decimals land in TEXT columns on purpose — SQLite's NUMERIC affinity would silently convert them to lossy REAL.
  • Unsigned BIGINT values beyond the signed 64-bit range are stored as exact text rather than corrupted floats.
  • Dates and times are stored as ISO-8601 text, the SQLite convention.

Frequently asked questions

Is SQL Server to SQLite migration production-ready in DBShifts?

Yes. SQL Server to SQLite is a certified pair: it passes the live certification suite on real SQL Server and SQLite servers, which checks schema fidelity, row counts, type-aware checksums and paging across batches.

What happens to SQL Server types that SQLite doesn't have?

Each gets the nearest SQLite type the converter treats as safe: BIT becomes INTEGER, DATE becomes TEXT, DATETIME becomes TEXT, DATETIME2 becomes TEXT, DATETIMEOFFSET becomes TEXT. Every such decision is in the migration plan before anything runs, and any mapping can be overridden per column.

Can I keep SQL Server and SQLite in sync after the initial migration?

Yes, until you cut over. DBShifts reads SQL Server Change Tracking, which has to be enabled on the database and on each table. With zero-downtime mode on, the tracking version is captured before the first row is copied.

Which SQL Server data types need a second look when moving to SQLite?

The table above carries a note on 4 of them: MONEY (NUMERIC), FLOAT (REAL), DATETIMEOFFSET (TEXT), UNIQUEIDENTIFIER (TEXT). Analysis flags the same columns on your own schema before any data moves.

Go deeper

Ready to move SQL Server to SQLite?

Set up in under two minutes. Validation and rollback included.

Start Free Migration