Get a list of table and column names created in the database

Page updated :

Typically, sql includes table and column names to select or INSERT, but you can also get the names of tables and columns that are created on the titer base in SQL. If you can do this, you can create dynamic SQL that automatically follows the number of tables and columns.

The SQL that gets a list of table and column names is as follows: You can get more information, but it has minimal configuration here.

select
  t.name as table_name
 ,c.name as column_name
from sys.tables as t
inner join sys.columns as c
  on c.object_id = t.object_id
order by t.name, c.object_id

The results are displayed as follows: