June 13, 2013 at 10:50 pm
Good Question.... but ,before select statement, he is dropping the table so select statement returns error but there is no option in answer list.
June 13, 2013 at 10:51 pm
My eyes winked when I looked at this code
DROP TABLE [dbo].[IndexTable]
SELECT * FROM indextable
Qotd aks about "the output of select statement", but as per the code this will give "error" 🙂
Though I understood the intention and answered accordingly. A nice question otherwise. Thanks Chirag!
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
June 13, 2013 at 11:14 pm
Was a good question - but if I had to follow the script it would have resulted in an error as previously pointed out.
Drop was before select ...
Hope this helps...
Ford Fairlane
Rock and Roll Detective
June 14, 2013 at 12:28 am
Excellent question. Keep it up.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 14, 2013 at 1:16 am
Lokesh Vij (6/13/2013)
My eyes winked when I looked at this code
DROP TABLE [dbo].[IndexTable]
SELECT * FROM indextable
Qotd aks about "the output of select statement", but as per the code this will give "error" 🙂
Though I understood the intention and answered accordingly. A nice question otherwise. Thanks Chirag!
same here
+1 🙂
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 14, 2013 at 1:27 am
I wonder what version of SQL this was tested against - running it against my Test box (2008 R2) all goes well until INSERT INTO [dbo].[IndexTable]
VALUES(3, 'Value3')
Then I get the error "Msg 8655, Level 16, State 1, Line 1
The query processor is unable to produce a plan because the index 'PK_IndexTable' on table or view 'IndexTable' is disabled."
Any ideas?
-------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
June 14, 2013 at 1:53 am
Stuart Davies (6/14/2013)
I wonder what version of SQL this was tested against - running it against my Test box (2008 R2) all goes well untilINSERT INTO [dbo].[IndexTable]
VALUES(3, 'Value3')
Then I get the error "Msg 8655, Level 16, State 1, Line 1
The query processor is unable to produce a plan because the index 'PK_IndexTable' on table or view 'IndexTable' is disabled."
Any ideas?
Since table "IndexTable" is a clustered table and before this insert statement, we have disabled the clustered index. This prohibits us to read/write rows into the table. And hence this error message.
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
June 14, 2013 at 2:10 am
kapil_kk (6/14/2013)
Lokesh Vij (6/13/2013)
My eyes winked when I looked at this code
DROP TABLE [dbo].[IndexTable]
SELECT * FROM indextable
Qotd aks about "the output of select statement", but as per the code this will give "error" 🙂
Though I understood the intention and answered accordingly. A nice question otherwise. Thanks Chirag!
same here
+1 🙂
+1. A tad misleading given that the table would be dropped before the select statement is executed! Answered correctly though when put into correct context.
email: info@weekendwebdesign.co.uk
Personal Website: http://markallen.co.uk/
Business Website: https://www.weekendwebdesign.co.uk
June 14, 2013 at 2:46 am
Ha.
I missed the DROP TABLE due to the scrolling code window. Otherwise I would have been very confused. But I don't think this distracts from the point the QotD was making.
I had to check whether reorg would re enable the index. And it's only the REBUILD. Which does make sence.
Good question, even with the SELECT and DROP in the wrong order.
Rodders...
June 14, 2013 at 3:42 am
Good Question.... but ,before select statement, he is dropping the table so select statement returns error.
There is no option in answer list.
June 14, 2013 at 4:40 am
This would have been a good question if the author had checked that it produced the expect result before he submitted it, and corrected it when he discovered that instead of 3 rows the select returned an error. As it is, it's not actually as bad as yesterday's question, but it's not really very good either.
Tom
June 14, 2013 at 5:06 am
Lokesh Vij (6/13/2013)
My eyes winked when I looked at this code
DROP TABLE [dbo].[IndexTable]
SELECT * FROM indextable
Qotd aks about "the output of select statement", but as per the code this will give "error" 🙂
Though I understood the intention and answered accordingly. A nice question otherwise. Thanks Chirag!
+1 🙂
Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
June 14, 2013 at 6:21 am
I do appreciate the volunteer nature of this...but it is getting very tedious to guess what is wrong with the question and or answers before taking a stab at it.
I suppose that this frustration is very much like my real working life 😉
June 14, 2013 at 7:51 am
Danny Ocean (6/14/2013)
Lokesh Vij (6/13/2013)
My eyes winked when I looked at this code
DROP TABLE [dbo].[IndexTable]
SELECT * FROM indextable
Qotd aks about "the output of select statement", but as per the code this will give "error" 🙂
Though I understood the intention and answered accordingly. A nice question otherwise. Thanks Chirag!
+1 🙂
+1 :hehe:
Viewing 15 posts - 1 through 15 (of 29 total)
You must be logged in to reply to this topic. Login to reply