Indexing

  • Comments posted to this topic are about the item Indexing

  • Good Question.... but ,before select statement, he is dropping the table so select statement returns error but there is no option in answer list.

  • 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


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • 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

  • Excellent question. Keep it up.


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • 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/

  • 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 questionThere 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

  • 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 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?

    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


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • 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.


    MCITP
    MCTS - E-Business Card
    Twitter: WWDMark

    Try not! Do or do not, there is no try

    email: info@weekendwebdesign.co.uk
    Personal Website: http://markallen.co.uk/
    Business Website: https://www.weekendwebdesign.co.uk

  • 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...

  • Good Question.... but ,before select statement, he is dropping the table so select statement returns error.

    There is no option in answer list.

  • 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

  • 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 !!!

  • 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 😉

  • 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:



    Everything is awesome!

Viewing 15 posts - 1 through 15 (of 30 total)

You must be logged in to reply to this topic. Login to reply