所以我想从整个数据库的所有表中进行一次大搜查
语句应该怎么写?谢谢
11 个解决方案
#1
select object_name(id) from syscolumns
where [name]='Name'
where [name]='Name'
#2
SELECT NAME FROM SYSCOLUMNS WHERE ID=OBJECT_ID('TB')
#3
select b.[name] from syscolumns a,sysobjects b
where a.[name]='Name'
and object_name(a.id)=b.[name]
and b.xtype='U'
#4
select name from sys.columns where name ='你想要找的col'
#5
这个更加严谨!
#6
select distinct b.name from sys.columns a,sys.tables b
where a.[name]='Name' and b.is_ms_shipped = 0
#7
select b.[name] from syscolumns a,sysobjects b
where a.[name]='Name'
and object_name(a.id)=b.[name]
and b.xtype='U'
正解
#8
学习!!
#9
学习
#10
select tab.name
from syscolumns as col
inner join sysobjects as tab on col.id=tab.id
where col.name='Item_IDX'
from syscolumns as col
inner join sysobjects as tab on col.id=tab.id
where col.name='Item_IDX'
#11
#1
select object_name(id) from syscolumns
where [name]='Name'
where [name]='Name'
#2
SELECT NAME FROM SYSCOLUMNS WHERE ID=OBJECT_ID('TB')
#3
select b.[name] from syscolumns a,sysobjects b
where a.[name]='Name'
and object_name(a.id)=b.[name]
and b.xtype='U'
#4
select name from sys.columns where name ='你想要找的col'
#5
这个更加严谨!
#6
select distinct b.name from sys.columns a,sys.tables b
where a.[name]='Name' and b.is_ms_shipped = 0
#7
select b.[name] from syscolumns a,sysobjects b
where a.[name]='Name'
and object_name(a.id)=b.[name]
and b.xtype='U'
正解
#8
学习!!
#9
学习
#10
select tab.name
from syscolumns as col
inner join sysobjects as tab on col.id=tab.id
where col.name='Item_IDX'
from syscolumns as col
inner join sysobjects as tab on col.id=tab.id
where col.name='Item_IDX'