根据字段名找表名

-- 根据表名找表信息

-- Sql Server

select * from sysobjects where xtype='U' and name = '表名';

-- Oracle

select table_name,tablespace_name,temporary from user_tables where table_name='TEST_TEMP'; --(表名变量值必须大写)

 

-- 根据字段找对应表名

-- Sql Server

select   a.name   table_name ,b.name   column_name   from   sysobjects   a,syscolumns   b   where   a.id=b.id   and   b.name='字段名'  and   a.type='U' order by a.name

-- Oracle

select table_name  from DBA_TAB_COLUMNS where COLUMN_NAME='字段名';

 

posted @ 2013-10-15 10:13  xki  阅读(500)  评论(0编辑  收藏  举报