Forum Discussion
Table Hint Position in From Clause
The documentation (https://learn.microsoft.com/en-us/sql/t-sql/queries/from-transact-sql?view=sql-server-ver16) for the FROM clause syntax shows the table hints after the table alias. I have recently come across a few queries in which the developer put a nolock hint between the table name and the alias, e.g., FROM dbo.Customer (nolock) cst. No error is thrown. I do not have access to view query plans.
Do table hints placed between the table name and alias do anything?
Thank you.
No error is thrown.Mister_Gregory that's old syntax from Sybase time; that syntax is deprecated and one should avoid them.
Also you should always use the WITH keyword in combination with table/query hints, see
SQL Server, Deprecated Features object - SQL Server | Microsoft Learn
=> Table hint without WITH
2 Replies
- olafhelperBronze Contributor
No error is thrown.Mister_Gregory that's old syntax from Sybase time; that syntax is deprecated and one should avoid them.
Also you should always use the WITH keyword in combination with table/query hints, see
SQL Server, Deprecated Features object - SQL Server | Microsoft Learn
=> Table hint without WITH
- Mister_GregoryCopper Contributor
olafhelper - Thank you very much!