How do I list all the columns in a table?

前端 未结 12 683
挽巷
挽巷 2020-12-07 07:31

For the various popular database systems, how do you list all the columns in a table?

12条回答
  •  轮回少年
    2020-12-07 08:05

    Example:

    select Table_name as [Table] , column_name as [Column] , Table_catalog as [Database], table_schema as [Schema]  from information_schema.columns
    where table_schema = 'dbo'
    order by Table_name,COLUMN_NAME
    

    Just my code

提交回复
热议问题