查詢某欄位名在哪些表中

2021-05-28 16:32:51 字數 620 閱讀 2274

select name

from sysobjects

where (id in

(select id

from syscolumns

where (name = 'fieldname')))

所有使用者表資訊在 系統表sysobjects中,所有使用者表字段資訊在系統表syscolumns中

********************===

通過下面sql得到當前資料庫中表名  

select   name   from   sysobjects   where   xtype='u'  

當然儲存過程exec   sp_tables也能得到,只要比系統表去掉就可以了  

sql語句查詢表的欄位名

select name from syscolumns where id in (select id from sysobjects where type = 'u' and name = '相應表名') 

用以上sql語句輸入相應表名就可以查到表的欄位名,對應好資料庫 查詢是否存在該錶語句   

當然儲存過程exec   sp_columns   @table_name   =   'tablename'也能得到了

查詢表的欄位名

select name from syscolumns where id in select id from sysobjects where type u and name 相應表名 用以上sql語句輸入相應表名就可以查到表的欄位名,對應好資料庫 查詢是否存在該錶語句 if exists sele...

Oracle中修改表中欄位名

更改欄位名 modify 不能用於更改欄位名 alter table emp modify address address err 解決方法 create table ut as select name,tel,id empid from emp 將 emp中資料取出並存到新建的表ut中,並將字段i...

查詢表的欄位名 SQL的基本查詢

基本的查詢語句 select,from語句用法,從表中選擇需要查詢的字段 常用句式 select 欄位名1 欄位名2 from 表 號代表查詢表中所有字段 除了基本查詢外,還可以將列 欄位名 在查詢時重新命名,使用as distinct 刪除重複值的資料 select distinct 姓名 fro...