How to Fix SQL Server Error 360 (Msg 360)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get sql server error 360 when a write query targets conflicting column types. To fix it, target either the sparse column or the column set alone. This failure returns message code 360 at severity 16 in the database engine. It stops insert, update, and merge queries from changing data in the target table. A severity 16 error means the user can fix the query syntax right away. You do not need to restart the server or rebuild your table indexes. What causes sql server error 360 in the databa

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 360 when a write query targets conflicting column types. To fix it, target either the sparse column or the column set alone.

This failure returns message code 360 at severity 16 in the database engine. It stops insert, update, and merge queries from changing data in the target table. A severity 16 error means the user can fix the query syntax right away. You do not need to restart the server or rebuild your table indexes.

What causes sql server error 360 in the database engine

Tables can use sparse columns to save space when many rows hold null values. Admins often group all sparse columns in a table into one single column set. That column set lets an app read or write all sparse columns at once. Still, the database engine blocks queries that mix these two methods in one command.

The official message states that the target column list cannot contain both items. If an insert, update, or merge lists a sparse column and the column set, it fails. The engine cannot tell which value should win when both appear in one statement. It stops the transaction and rolls back the change to keep table data safe.

This bug often happens when an app builds queries from a full table schema. Many object mapper tools read all column names and put them in an insert list. Since the column set looks like a normal column, the tool includes it too. The query then sends both the sparse column and the column set to the server.

How to diagnose and fix the failure in production

First, find the exact query that caused the error in your app error logs. Check the target table structure to see which columns use the sparse setting. You only need read rights on the database to check the table schema. In SQL Server, members of the fixed datareader role can read all user tables.

Next, pick one way to write data in the failing insert, update, or merge statement. If your query only changes one or two sparse columns, remove the column set name. List only the specific sparse columns you want to change in the target list. This approach works best for small updates that touch a few fields.

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 your app sends a full document for all sparse fields, use the column set. Remove every individual sparse column name from the target list of your write query. Keep only the regular columns and the single column set in the statement. Test the fixed query in a staging database before you run it in production.

Keeping database permissions safe during fixes

Engineers often ask for broad rights when they debug failed production write queries. Never grant the fixed owner role just to fix a query syntax error. Members of the owner role can change all settings and even drop the database. Instead, keep permissions small and match the exact task at hand.

A database user is the identity of a login when it connects to a database. For access to many databases on an instance, a login in master is common. For access to one or a few databases, a contained user is an option. An admin must first enable contained databases on the server and the database.

Give devs read access to inspect schemas while you test the fix in staging. Members of the fixed datawriter role can add, delete, or change data in tables. You cannot change the permissions assigned to fixed database roles in the engine. When prod data includes emails or phone numbers, masking rewrites matched fields in results.

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

What does severity 16 mean for message 360?

Severity 16 means the error comes from a mistake in the user query. The database engine is healthy, and you can fix the issue by editing SQL.

Can I update a regular column and a column set together?

Yes, your query can update normal columns and the column set at the same time. The error only triggers when you include a sparse column and its column set together.

Why did my data tool trigger sql server error 360?

Data tools often grab all column name from a table to build insert statements. You must configure the tool to skip either the column set or the sparse columns.

The query runs. The emails stay hidden.