February 20, 2013 at 8:17 pm
Comments posted to this topic are about the item Locking Hints
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
February 20, 2013 at 10:20 pm
Easy and Nice question for the day. Thanks Serge 🙂
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
February 20, 2013 at 11:27 pm
🙂
Lokesh Vij (2/20/2013)
Easy and Nice question for the day. Thanks Serge 🙂
SQL Server assumes that this is a table alias 😀
+1
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
February 21, 2013 at 12:37 am
Nice question, but the explanation lacks important information. Let me quote it for you here:
Table Hints (Transact-SQL) - SQL Server 2008 R2
WITH ( <table_hint> ) [ [ , ]...n ]With some exceptions, table hints are supported only when the hints are specified with the WITH keyword. Parentheses are required.
Important note
Important
Omitting the WITH keyword is a deprecated feature and will be removed in a future version of Microsoft SQL Server. Always specify WITH in new development work, and modify applications that currently omit this keyword.
Separating hints by spaces instead of commas is a deprecated feature and will be removed in a future version of Microsoft SQL Server. Always specify commas in new development work, and modify applications that currently omit commas.
The following table hints are allowed with and without the WITH keyword: NOLOCK, READUNCOMMITTED, UPDLOCK, REPEATABLEREAD, SERIALIZABLE, READCOMMITTED, FASTFIRSTROW, TABLOCK, TABLOCKX, PAGLOCK, ROWLOCK, NOWAIT, READPAST, XLOCK, and NOEXPAND. When these table hints are specified without the WITH keyword, the hints should be specified alone. For example, FROM t WITH (TABLOCK). When the hint is specified with another option, the hint must be specified with the WITH keyword. For example, FROM t WITH (TABLOCK, INDEX(myindex)).
The restrictions apply when the hints are used in queries against databases with the compatibility level of 90 and higher.
http://msdn.microsoft.com/en-us/library/ms187373%28v=sql.105%29.aspx
If you are working with a different SQL Server version, be sure to read the corresponding documentation version as well.
Best Regards,
Chris Büttner
February 21, 2013 at 1:10 am
Nice and easy one. Initially I overlooked the word WTH and answered the question. After seeing the explaination only i realised it was mispelled and it will act as alias name.
Thanks for your brief explaination Chris Büttner ...
--
Dineshbabu
Desire to learn new things..
February 21, 2013 at 1:28 am
I see what you did there, nice 1.
Good Question!
Regards
ld
Stoke-on-Trent
United Kingdom
If at first you don't succeed, go to the pub and drink away your current thought plan.
February 21, 2013 at 2:37 am
This was removed by the editor as SPAM
February 21, 2013 at 3:28 am
Dineshbabu (2/21/2013)
Nice and easy one. Initially I overlooked the word WTH and answered the question. After seeing the explaination only i realised it was mispelled and it will act as alias name.Thanks for your brief explaination Chris Büttner ...
+1
seriously... i forgot to wear my glasses and for WTH I actually read as WITH and when my choice was marked as wrong I was really like WTH (i mean the.... expression) and then whole thing came to my understanding...
Really interesting question, thank you for posting... more to see like these... so simple... and yet... i scr.... up
(not sure what is with me... I am getting dumber and dumber each day... as I am supposed to be going the other way.. duh!!! ) 😉
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
February 21, 2013 at 3:58 am
Thanks for an excellent question today.
February 21, 2013 at 4:31 am
Interesting question - luckily I spotted 'WTH' wasn't colour coded as keyword and was mispelt 🙂
MCTS | MCITP | Microsoft SQL Server 2008 Administration & Development
MCSA | MCSE | Business Intelligence SQL Server 2012
February 21, 2013 at 5:41 am
good one !!!
Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
February 21, 2013 at 6:40 am
Good question.
I'm glad that missing out WITH is deprecated though, so that teh answer to this question will change in the future. In fact I think it's a great pity that it hasn't already disappeared in SQL 2012 (cf http://msdn.microsoft.com/en-us/library/ms187373.aspx. After all, it had already been deprecated in SQL 2005, SQL 2008, and SQL 2008 R2, and surely 3 releases is enough warning for something like this?
Tom
February 21, 2013 at 7:11 am
Good question, you almost got me! 😀
February 21, 2013 at 8:01 am
L' Eomot Inversé (2/21/2013)
Good question.I'm glad that missing out WITH is deprecated though, so that teh answer to this question will change in the future. In fact I think it's a great pity that it hasn't already disappeared in SQL 2012 (cf http://msdn.microsoft.com/en-us/library/ms187373.aspx. After all, it had already been deprecated in SQL 2005, SQL 2008, and SQL 2008 R2, and surely 3 releases is enough warning for something like this?
Obviously I don't have 2012 but for curiosity purposes, in 2008 you can use a tablehint without using WITH keyword on any 1 hint but for 2 hints you have to specify it. e.g. WITH(noexpand, nolock)
In 2012 is that now removed?
Regards
ld
Stoke-on-Trent
United Kingdom
If at first you don't succeed, go to the pub and drink away your current thought plan.
February 21, 2013 at 8:01 am
Nice question.
I didn't know the WITH has been optional for hints.
Viewing 15 posts - 1 through 15 (of 34 total)
You must be logged in to reply to this topic. Login to reply