Saturday, October 17, 2020

View SQL Table Names in Alphabetical Order

 When you have a SQL table with multiple fields and if you want to view the fields in alphabetical order, use this script.

SELECT 

    COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, IS_NULLABLE, ORDINAL_POSITION

    FROM INFORMATION_SCHEMA.COLUMNS

        WHERE TABLE_NAME = <Your Table Name inside quotes>

        ORDER BY COLUMN_NAME ASC 

All Blogs so far ...