How to Fix SQL Server Error 948 (Msg 948)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get sql server error 948 when you attach or restore a newer database onto an older server. You fix it by upgrading your target server or exporting the data with scripts. Every database file has an internal version number set by the engine. When a server sees a higher number than it supports, it blocks the action. The engine logs message 948 at severity level 20 and stops the task. Root causes of sql server error 948 in the engine The official message states that the database cannot open

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You get sql server error 948 when you attach or restore a newer database onto an older server. You fix it by upgrading your target server or exporting the data with scripts.

Every database file has an internal version number set by the engine. When a server sees a higher number than it supports, it blocks the action. The engine logs message 948 at severity level 20 and stops the task.

Root causes of sql server error 948 in the engine

The official message states that the database cannot open because of its version. It lists the file version and the maximum version the server supports. It also states that a downgrade path is not supported by the engine.

This problem happens most often during migrations, disaster recovery tests, or local work. A developer might back up a database from a newer test server. Then they try to restore that backup onto an older local instance.

The same failure occurs when you detach and move data files across servers. Even minor build gaps between servers can change the internal file number. Once a newer engine upgrades the file structure, older engines cannot read it.

Compatibility levels do not change this internal storage version number at all. Setting a lower compatibility level only changes how queries run inside the database. It does not let you move the physical file to an older engine.

How to diagnose and fix the failure safely in production

First, check the exact message in your server error log. The message gives you two numbers to compare. The first number is the version of the database file you used. The second number is the highest version your current server can open.

The cleanest fix is to upgrade the target server to match the source. Apply the needed updates or install a matching server edition on the target. Once both servers share the same internal version, the restore will work.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If you cannot upgrade the target server, you must move the data logical structures. Keep the database running on the newer server where it was created. Generate scripts for the schema and objects from that source server. Then run those scripts on the older target server to build empty tables.

After the tables exist, copy the rows over using a bulk export tool. Keep permissions tight while your team performs this data transfer work. Do not grant the database owner role to people who only export rows.

In this database engine, the owner role can drop the whole database. Instead, put export accounts in the fixed data reader role on the source. Members of the data reader role can read all user tables and views. On the target server, use the fixed data writer role to load rows. The data writer role lets a user add, change, or delete table data. You cannot change the permissions assigned to these fixed database roles.

How to prevent version mismatches across teams

Version errors happen when teams run different database builds across their stages. Keep development, staging, and production instances on the exact same engine build. When you patch one server, schedule the same patch for the others.

You should also limit who can run restore or attach tasks in production. A database user is the identity of a login inside one database. For access to many databases, a login in the master database is common. For one or a few databases, a contained user with a password works. An admin must first enable contained databases on the server and database.

Give your staff the lowest role needed for their daily work. Every role, including the public role, has basic connect rights by default. Use the deny data writer role if an account must never change data. Good role hygiene stops ad hoc file moves before they break a server.

Add runtime guardrails beside SQL Server

Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.

Frequently asked questions

Can I lower the database compatibility level to fix error 948?

No, changing the compatibility level does not lower the physical file version. Compatibility levels only control how query features work, not where files can open.

Does SQL Server support downgrading a database backup file?

No, the database engine does not support a direct downgrade path for backups. You must upgrade the target instance or export the schema and data separately.

What does severity 20 mean for message 948?

Severity 20 means the engine found a fatal problem with the current task. It terminates the user task right away, though the server itself stays online.

The query runs. The emails stay hidden.