What is the SQL command to return the field names of a table?

后端 未结 12 1202
野的像风
野的像风 2020-12-05 07:03

Say I have a table called myTable. What is the SQL command to return all of the field names of this table? If the answer is database specific then I need SQL Server right

12条回答
  •  Happy的楠姐
    2020-12-05 07:25

    You can use the provided system views to do this:

    eg

    select * from INFORMATION_SCHEMA.COLUMNS
    where table_name = '[table name]'
    

    alternatively, you can use the system proc sp_help

    eg

    sp_help '[table name]'
    

提交回复
热议问题