34,837
社区成员




select * from
(
select name from sys.columns c,
sys.objects o where
c.object_id = o.object_id
and o.name = 't1'
) t1,
(
select name from sys.columns c,
sys.objects o where
c.object_id = o.object_id
and o.name = 't2'
) t2
where t1.name like t2.name
select object_name(a.id) 表A,a.name A_name,b.name B_name,object_name(b.id) 表B
from syscolumns a
join syscolumns b
on a.id=object_id('t1') --表A
and b.id=object_id('t2') --表B
and (a.name like '%'+b.name+'%'
or b.name like '%'+a.name+'%')