I easily learn something new everyday, sometimes it's even valuable ;). Here's a tidbit I learned only today: When you specify table hints in a query, the WITH keyword isn't required in SQL Server 200. Here's a quote from Books Online:
The use of the WITH keyword is encouraged, although it is not currently required. In future releases of SQL Server, WITH may be a required keyword.
To be quite honest... if I were going to build any sproc, or other production worthy code I'm sure I'd leave the WITH keyword in. But for quick ad-hoc queries where I don't want to interfere with an OLTP Database (i.e. lock it) I'm quite happy being able to do something akin to:
SELECT * FROM pubs.dbo.employee NOLOCK
Instead of:
SELECT * FROM pubs.dbo.employee WITH(NOLOCK)
That may seem like "small potatoes," but in the end, not having to hit the ( and ) does make a tad bit of difference.
As for the warning that the WITH keyword may be required in future versions, I've checked it on the Yukon beta, and so far it works without the WITH keyword as well. Only time will tell if that gets changed.
Comments