SQL Server Error 1072: Remote Hint Fix Guide
In this article
SQL Server error 1072, "A remote hint can only be specified," occurs when a query hint meant for a remote data source is placed on a table or query that is not actually remote. The fix is to remove the hint or rewrite the query so the hint is applied only to a remote table reference. In practice, this means checking for hints like OPTION (REMOTE JOIN) or table hints used with linked servers and ensuring they are attached to the correct part of the query. The steps below walk you through identifying the cause, correcting the T-SQL, and verifying the result. You will need access to the database and the ability to edit the query or stored procedure.
What You'll Need
- Access to SQL Server Management Studio (SSMS) or another client that can run T-SQL.
- Permission to view and modify the query, view, or stored procedure that raises the error.
- The name of the linked server or remote data source involved, if any.
- A test environment where you can run the query without affecting production data.
Step-by-Step
- Reproduce the error and capture the full message. Run the failing query in SSMS. Note the exact text: error 1072 usually appears with a line number and a hint name. This tells you which hint is being rejected.
- Locate the hint in the query text. Search for common remote hints such as
REMOTE,REMOTE JOIN, or any table hint applied to a four-part name (for exampleServerName.DatabaseName.SchemaName.TableName). Also check forOPTION (REMOTE ...)at the end of the query. - Confirm whether the target is actually remote. A remote hint is only valid when the table reference points to a linked server or a remote data source. If the table is local, the hint is invalid. Check the four-part name: if the server part matches the local instance, it is not remote.
- Remove the remote hint if the table is local. Delete the hint from the query. For example, change
SELECT * FROM LocalTable WITH (REMOTE)toSELECT * FROM LocalTable. Save and rerun the query. - If the table is remote, move the hint to the correct clause. Remote hints must be placed where SQL Server expects them. For a linked server query, use
OPTION (REMOTE JOIN)at the end of the statement, not as a table hint. For example:SELECT * FROM LocalTable INNER JOIN LinkedServer.Db.dbo.RemoteTable ON ... OPTION (REMOTE JOIN);. - Check for hints inside views or stored procedures. If the error comes from a view or procedure, the hint may be buried in its definition. Use
sp_helptextor Object Explorer to script the object and inspect it. Edit the definition to remove or relocate the hint, thenALTERthe object. - Test with a simplified query. Isolate the problem by running only the part of the query that uses the hint. If it succeeds, add back joins and filters one at a time until the error returns. This pinpoints the exact table or clause causing the issue.
- Verify the linked server configuration. If you intend to use a remote hint, ensure the linked server is set up correctly and that the remote table is accessible. In SSMS, expand Server Objects > Linked Servers and test the connection. A misconfigured linked server can cause hints to be rejected.
- Update statistics and clear the plan cache if needed. After changing the query, SQL Server may reuse an old plan. Run
DBCC FREEPROCCACHEon a test server (never in production without approval) or usesp_recompileon the affected object to force a new plan. - Deploy the corrected query. Once the query runs without error in testing, apply the change to production. Monitor for any performance changes, since removing a hint can alter the execution plan.
Common Mistakes
- Applying a remote hint to a local table. This is the most frequent cause. Double-check that the table name includes a linked server prefix.
- Using the wrong hint syntax.
REMOTEis not a valid table hint in all contexts;OPTION (REMOTE JOIN)is the correct form for forcing a join to run remotely. - Forgetting to schema-qualify remote tables. Use the full four-part name:
LinkedServer.Database.Schema.Table. - Editing the query but not the underlying view or procedure. The error may persist if the hint lives in a nested object.
- Assuming the error is a bug. Error 1072 is a syntax and placement issue, not a server fault.
Tips
- Use
SET SHOWPLAN_ALL ONor the actual execution plan to see how the hint affects the query before and after removal. - Keep a copy of the original query so you can compare plans and performance.
- If you need to force a join to run on the remote server for performance, test both with and without
OPTION (REMOTE JOIN)to confirm it helps. - Document any hints you add, since they can become a maintenance burden.
Troubleshooting
If the error persists after removing the obvious hint, check for hints in triggers, user-defined functions, or computed columns that reference the table. Also verify that the query is not using a synonym that points to a remote table; the hint must be applied to the synonym, not the base table. If you are using dynamic SQL, ensure the hint is not being concatenated incorrectly. In rare cases, the error can be caused by a mismatch between the SQL Server version and the linked server provider; updating the provider or using a different access method may help. If you cannot modify the query (for example, it is generated by a third-party application), consider creating a local copy of the remote data or using a view that encapsulates the logic without the hint.
Frequently Asked Questions
What does error 1072 mean exactly?
It means a hint that is only valid for remote data sources was used on a table or query that is not remote. SQL Server rejects the hint to prevent incorrect behavior.
Can I use REMOTE as a table hint?
No, REMOTE is not a valid table hint. The correct way to force a remote join is to use OPTION (REMOTE JOIN) at the end of the query.
Why does the error appear only sometimes?
It may depend on the data or the execution plan. If the query is recompiled or the plan changes, the hint may be evaluated differently. Always test with the same data and settings.
Does removing the hint affect performance?
It can. A remote hint is often used to improve performance by pushing joins to the remote server. Removing it may cause more data to be transferred. Test both versions and compare execution plans.
Can I use remote hints with Azure SQL Database?
Azure SQL Database does not support linked servers in the same way as on-premises SQL Server, so remote hints are generally not applicable. Use elastic queries or other Azure-specific features instead.
What if the hint is inside a view I cannot edit?
You can create a new view that selects from the original without the hint, or use sp_helptext to script the definition and modify it if you have permission. Otherwise, contact the view owner.