sql server - show the names of the columns of different tables in the same order than these appeared in every table in sql -
i need bring technical report describing table columns belongs database. thing is, required bring - let´s call - descripcion of tables in database respecting order of columns inside table.
for example, if have table_1 has columns column_d,column_a,column_m,column_e in particular order, should bring report this
table - column
table_1 column_d
table_1 column_a
table_1 column_m
table_1 column_e
and on table in database.
i using query
select t.name, c.name sys.columns c inner join sys.tables t on c.object_id = t.object_id
the problem getting information want, organized column field.
table - column
table_1 column_a
table_1 column_d
table_1 column_e
table_1 column_m
but if add clause query
select t.name, c.name sys.columns c inner join sys.tables t on c.object_id = t.object_id c.object_id = 123
i have result want particular table.
is there way need?
without order clause, leaving ordering sql determine based on optimised query execution. want:
select t.name, c.name sys.columns c inner join sys.tables t on c.object_id = t.object_id order t.name, c.column_id