• Wayne West (11/19/2014)


    Luis Cazares (11/18/2014)


    Wayne West (11/18/2014)


    I've made two minor tweaks, commenting out the sc.name on the Order By so that the fields display in the order of the structure of the table

    I just wanted to note that it's not guaranteed that you'll get the columns displayed in the correct order. To ensure that, you need to include the ordinal position in the order by.

    ...

    UPDATE: It seems that the 'ordinal' parameter is undocumented as the others properties used in Information_Schema.Columns

    True. In the code that I'm working on, I have it by ordinal position. I'm not sure why you'd want the field names alphabetical, that's kinda baffling me.

    I don't remember when Information_Schema came in to play, I think with SQL 2005, so when this thread started, they were probably still on 2000. But I'm using Information_Schema in the code that I'm working on, so hopefully it'll have long legs.

    You should be safe using Information_Schema as those views were introduced to comply with SQL-92 Standard. The problem you could face is not having enough information on them that is available on system views.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2