Using sys.index_columns

  • Several good tidbits in here, including demonstrating how important code formatting is for readability. 🙂

    Thanks for a good question.

  • GilaMonster (12/20/2011)


    Hmm, this looks familiar. 😉

    Seemed familiar from a tweet conversation involving you.:cool:

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • R.P.Rozema (12/20/2011)


    :). Yes, that's how this question got to be: I did it wrong myself. And so far almost half of the people who tried, had it wrong too. To their avail, the ill-formatted answers don't help them...

    Once more, thanks for your assistance.

    Meh - not too concerned about the answer format. Still a good question.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • tks - good question

  • Good question.

    The formatting didn't bother me a whole lot since I did what I usually do with this type of question. I ran along comparing them line by line to see what the differences were. Once I knew what the differences were I knew what columns you were testing on and could easily go from there. I never really tried to interpret the queries as a whole.

    I do love system table questions though. Always a lot of fun.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • Nice question on something I don't believe I've ever thought much about. I learned something!

    Thanks, can't wait for your next!

  • Nice question. Keep 'em coming!

  • Good question. The formatting wasn't an issue for me, I just pasted the answers into notepad and started to put line breaks and spaces where I would put them if writing SQL - and realised before I finished that I would be wasting time doing any more formatting as the four answer options were identical apart form a couple of column names, which made it all pretty clear (apart from remembering which of the column ids was the id in the parent table).

    I think the explanation is slightly wrong, though, as it seems to suggest that key_ordinal is the same as index_column_id in all entries in sys.index_columns for anything except columns of clustered indexes; but actually this can only be true for key columns, since for non-key columns key_ordinal is always 0.

    Tom

  • Thank you for the question

    Iulian

Viewing 9 posts - 16 through 23 (of 23 total)

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