Oracle查询表所有列名的SQL语句

网络整理 - 07-27

SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'T_PROPERTY' ORDER BY COLUMN_ID

  SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'T_PROPERTY' ORDER BY COLUMN_ID

  注意红色部分,如果表名是大写的,这里一定要大写哦。就因为我整个小写的表名,费了好久呢。

  sqlserver:

  select name from syscolumns where id=object_id('表名')

  select count(*) from syscolumns where id=object_id('表名')