How to Fix SQL Server Error 10787 (Msg 10787)

Published
Length
3 min read

Luis Felipe Dias

All posts

You trigger sql server error 10787 when a query uses strict isolation hints on Hekaton tables with columnstore indexes. To fix it, remove the repeatable read or serializable hints from your query text. The database engine returns this message with severity 16 when it parses invalid table hints. You can fix the issue in your app queries without changing table storage or user roles. Why sql server error 10787 happens in the engine The database engine throws message 10787 with a severity level

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 trigger sql server error 10787 when a query uses strict isolation hints on Hekaton tables with columnstore indexes. To fix it, remove the repeatable read or serializable hints from your query text.

The database engine returns this message with severity 16 when it parses invalid table hints. You can fix the issue in your app queries without changing table storage or user roles.

Why sql server error 10787 happens in the engine

The database engine throws message 10787 with a severity level of 16. The official message states that repeatable read and serializable hints are not permitted here. This rule applies to Hekaton tables that also have columnstore indexes.

Hekaton is the engine feature for tables that live in memory. Columnstore indexes store data by column rather than by row for fast scans. Combining memory tables with column indexes creates a fast setup for analytical queries.

Still, this hybrid table design has strict rules for transaction isolation levels. Standard row tables allow repeatable read and serializable hints on any query. When a query sends those two hints against this specific table type, the engine stops it.

The query fails before it reads or changes any rows in the database. Severity 16 means the error comes from user query rules rather than a server crash. Your database stays online, and other user queries keep running as normal.

How to find and fix the failing query in production

First, find the exact query or stored procedure that sends the forbidden table hint. Check your app error logs to see which service call triggered message 10787. Match the timestamp of the failure with the database query log.

Next, inspect the tables referenced in that failing statement. Confirm which table is a Hekaton memory table that also holds a columnstore index. Look at the table hints placed right after that table name in the query.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You will see a repeatable read hint or a serializable hint attached to the table. Edit the query or stored procedure to delete that unsupported hint. If your transaction requires a supported level, switch to a lower isolation hint instead.

Test the updated query in a staging database before you ship the change. Make sure the query returns the right rows and meets your speed goals. Then deploy the updated query code or stored procedure to your production servers.

Managing safe roles during production fixes

When engineers investigate query failures, they do not need full control of the server. Avoid granting the database owner fixed role during a routine query review. Members of that owner role can change settings and even drop the database.

Instead, give engineers a read role so they can check table data safely. The fixed data reader role lets users read all data from user tables and views. If a user needs to update data, the fixed data writer role covers that need.

You cannot change the permissions assigned to these built-in fixed database roles. If someone must never read table data, you can use the deny data reader role. You can also choose between a login user in master or a contained user.

For people who use many databases on one instance, a login in master is common. For access to one or a few databases, a contained database user is an option. An admin must first enable contained databases on the server and the database.

Check SQL Server batches and results on the wire

SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What is the exact message for SQL Server Error 10787?

The error states that repeatable read and serializable hints are not permitted on these tables. Specifically, it applies to Hekaton tables that have columnstore indexes. The engine returns this error at severity level 16.

Does error 10787 mean my memory table is corrupted?

No, severity 16 errors point to mistakes in user queries rather than storage damage. Your Hekaton table and its columnstore index remain intact and safe to read. Removing the unsupported isolation hint from the query resolves the failure right away.

Do I need owner permissions to check for this error?

No, you do not need the database owner fixed role to inspect queries or data. The fixed data reader role lets a user read all user tables and views safely. Keeping engineers out of the owner role protects the database from accidental drops.

The query runs. The emails stay hidden.