Why This Error Happens
Error 2014 occurs because SQL Server does not allow schema-bound views, functions, or computed columns to reference objects on a remote or linked server. Schema binding requires SQL Server to lock the underlying object’s schema to prevent structural changes, and this validation can only be guaranteed for local objects within the same instance. When a four-part name (referencing a linked server) or a remote data source is used inside a WITH SCHEMABINDING definition, the engine cannot enforce this dependency tracking, triggering the error.
Step-by-Step Resolution Guide
Step 1: Identify the Offending Schema-Bound Object
- Open SQL Server Management Studio (SSMS) and locate the view, function, or computed column causing the failure.
- Run the following query to find schema-bound objects referencing external sources:
SELECT object_id, name, type_desc
FROM sys.objects
WHERE is_schema_bound = 1;
- Check the object’s definition using
sp_helptext 'YourObjectName'to confirm it references a four-part name (e.g.,LinkedServer.Database.Schema.Table).
Step 2: Remove the Remote Reference from the Definition
- Edit the
CREATE VIEWorCREATE FUNCTIONstatement and remove theWITH SCHEMABINDINGclause if a remote/linked server reference is required. - Example fix:
ALTER VIEW dbo.MyView
-- WITH SCHEMABINDING -- Remove this line
AS
SELECT * FROM LinkedServerName.DB.dbo.RemoteTable;
- If schema binding is mandatory for performance or indexing reasons, redesign the logic to pull data locally first (see Step 3).
Step 3: Stage Remote Data Locally
- Create a local staging table or indexed view that imports the remote data using SQL Server Agent jobs, SSIS, or
OPENQUERY. - Point your schema-bound object to the local staging table instead of the linked server.
- Example:
SELECT * INTO dbo.LocalStagingTable
FROM OPENQUERY(LinkedServerName, 'SELECT * FROM RemoteDB.dbo.RemoteTable');
- Rebuild the schema-bound view/function against
dbo.LocalStagingTable.
Step 4: Validate Linked Server Configuration (If Still Required)
- Navigate to Server Objects > Linked Servers in SSMS and confirm the linked server connection is healthy via Test Connection.
- Ensure
RPCandRPC Outare enabled on the linked server properties if remote procedure calls are needed elsewhere in your environment (not inside schema-bound objects).
Alternative or Verification Steps
- Verify the fix by re-running the
CREATEorALTERstatement for the object — it should compile successfully without Error 2014. - If schema binding is non-negotiable, consider using an Indexed View on local replicated data (via Replication or Change Data Capture) instead of querying the linked server directly.