sqlserver 查询字段在哪个表里
展开全部
1、创建两张测试表,
create table test_col1(factory_id int, factory_name varchar2(20));
create table test_col2(factory_id int, factory_name varchar2(20));
2、查看test_col1的表结构,select * from user_tab_cols t where table_name = 'TEST_COL1',有两个字段,
3、查看test_col2的表结构,select * from user_tab_cols t where table_name = 'TEST_COL2',同样有两个字段,
4、查看factory_id、factory_name字段存在的所有表中记录情况,select * from user_tab_cols t where column_name in ('FACTORY_ID','FACTORY_NAME'),
展开全部
下边是SQLSERVER中查询某字段在哪些表中含有的语法:
select sysobjects.name from syscolumns inner join sysobjects on syscolumns.id = sysobjects.id and sysobjects.xtype = 'u' where syscolumns.name = '字段名字'
select sysobjects.name from syscolumns inner join sysobjects on syscolumns.id = sysobjects.id and sysobjects.xtype = 'u' where syscolumns.name = '字段名字'
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询