- Error number
- 7356
- Severity
- 16 (user-correctable error)
- State
- Not documented by Microsoft (not reproduced here)
- Product
- Microsoft SQL Server Database Engine
- Versions
- All supported SQL Server versions (2016 to 2025), Azure SQL Managed Instance (supported providers only)
- Category
- Linked Servers
- Last reviewed
- 24 October 2026
On this page
What it means
Error 7356 means a linked server provider described a remote column one way when SQL Server compiled the query and another way when it returned the rows, so SQL Server refused to use the data.
To compile a distributed query SQL Server asks the OLE DB provider for the columns of the remote object: type, length, precision, scale and flags such as nullability. It builds the plan on that answer. At run time it compares the rowset the provider actually returns with what it was told, and any difference in one of these properties stops the query with 7356, because a plan built for, say, a non-nullable 4 byte column cannot safely consume something else.
The message tells you exactly what differed: the column and its position, the remote object, the property (an OLE DB name such as DBCOLUMNFLAGS_ISNULLABLE, a column flag, or a length) and the two values. For flags the numbers are bit masks: DBCOLUMNFLAGS_ISNULLABLE is 32 (0x20) when set, so "0 at compile time and 32 at run time" means the provider first said NOT NULL and then delivered a nullable column.
Common causes
- The provider reports column metadata inconsistently, typically for computed or expression columns of a remote view (for example nullability or length of a column built with a function or a UNION).
- The remote object changed between compile and execution (a column altered, a view redefined) and the cached plan was reused without a schema check, for example with the linked server option
lazy schema validationon. - An older or third-party provider (Oracle, ODBC through MSDASQL, other databases) returns different metadata from its schema rowsets than from the result rowset.
- A provider upgrade or a change of provider for the same linked server, so the plan compiled with one description and runs against another.
Diagnose it
Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.
Which provider and schema options does the linked server use?
SELECT name, provider, product, data_source, lazy_schema_validation,
is_collation_compatible, uses_remote_collation, modify_date
FROM sys.servers
WHERE is_linked = 1; Find the linked server named in the message. lazy_schema_validation = 1 skips the remote schema check before running a cached plan, which lets remote changes surface at run time. modify_date shows a recent change of provider or options.
Which cached queries use the linked server?
SELECT TOP (20) cp.usecounts, cp.objtype, OBJECT_NAME(st.objectid, st.dbid) AS object_name,
LEFT(st.text, 200) AS query_start
FROM sys.dm_exec_cached_plans AS cp
CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) AS st
WHERE st.text LIKE N'%ORAHR%'
ORDER BY cp.usecounts DESC; Replace ORAHR with your linked server name. These are the plans compiled against the old metadata; a procedure listed here is the place to add OPTION (RECOMPILE) or explicit casts.
If the remote server is SQL Server: how is the column defined there?
Run this on the remote server, in the remote database, for the object in the message.
SELECT c.column_id, c.name, TYPE_NAME(c.user_type_id) AS type_name,
c.max_length, c.precision, c.scale, c.is_nullable, c.is_computed
FROM sys.columns AS c
WHERE c.object_id = OBJECT_ID(N'dbo.vOrders')
ORDER BY c.column_id; Compare the column at the ordinal from the message with the compile-time and run-time values. A view column that is an expression, or a column that was altered recently, is the usual suspect.
How to fix it
Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.
Fix the shape of the column in a pass-through query
Client or network sideUse OPENQUERY so the remote server runs the query, and make the type and nullability explicit there (a CAST, or NVL/ISNULL for nullability). The provider then describes a plain column and returns the same thing at run time.
SELECT employee_id, manager_id
FROM OPENQUERY(ORAHR,
'SELECT EMPLOYEE_ID, CAST(NVL(MANAGER_ID, 0) AS NUMBER(6)) AS MANAGER_ID
FROM HR.EMP_DETAILS_VIEW');
Recompile after the remote object changes
Client or network sideIf the remote object was altered, the next compilation picks up the new metadata. Add OPTION (RECOMPILE) to the distributed query (or recompile the procedure that contains it) so it is not run with a plan built for the old definition.
SELECT EMPLOYEE_ID, MANAGER_ID
FROM ORAHR..HR.EMP_DETAILS_VIEW
OPTION (RECOMPILE);
Turn lazy schema validation off for this linked server
Changes configurationWith the option off (the default), SQL Server checks the remote schema before it runs a cached plan and recompiles when it changed, instead of failing in the middle of the query.
EXEC master.dbo.sp_serveroption
@server = N'ORAHR', @optname = N'lazy schema validation', @optvalue = N'false';
Update or change the provider
Changes configurationIf the same remote column keeps producing 7356 without any schema change, the provider itself describes it inconsistently. Install the current version of the vendor provider on the SQL Server machine, or test the query through a different provider for that database.
Examples
A remote view column that the provider calls NOT NULL at compile time
Shown as the documented engine message with example values; not reproduced here. With a temporary loopback linked server using the SQL Server provider (MSOLEDBSQL) our tests of changed and stale remote views either recompiled silently or raised error 7359 (schema version changed), never 7356. Microsoft documents no state for 7356, so no header is shown. Linked server, object and column names are examples.
SELECT EMPLOYEE_ID, MANAGER_ID
FROM ORAHR..HR.EMP_DETAILS_VIEW;
The OLE DB provider "OraOLEDB.Oracle" for linked server "ORAHR" supplied inconsistent metadata for a column. The column "MANAGER_ID" (compile-time ordinal 4) of object ""HR"."EMP_DETAILS_VIEW"" was reported to have a "DBCOLUMNFLAGS_ISNULLABLE" of 0 at compile time and 32 at run time.
How to prevent it
Read remote data through pass-through queries (OPENQUERY or EXEC ... AT) that select named columns with explicit types, rather than four-part names over remote views with expression columns. Leave lazy schema validation off unless you have measured a real need for it.
Treat remote schema changes as deployments for the servers that consume them: after altering a remote table or view, recompile the local procedures that read it and test them.
Common questions
What does compile-time ordinal mean?
The position of the column in the remote object as the provider described it when the query was compiled, starting at 1. It identifies the column even when the name is ambiguous.
What are values such as 0 and 32 in the message?
They are the values of the property named in the message. For a DBCOLUMNFLAGS property they are bit flags (32 means the nullable flag is set); for length or precision they are plain numbers.
Will SELECT * through OPENQUERY avoid the error?
Not by itself. OPENQUERY helps when the remote query fixes the type and nullability of the column explicitly; a SELECT * can carry the same inconsistent column through.
Learn more on CodeWithSQL
Official documentation
- Database engine events and errors (7000 to 7999)
- OPENQUERY (Transact-SQL)
- sp_serveroption (Transact-SQL)
- Linked servers (Database Engine)
Last technically reviewed 24 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.