select a.name from
(select * from syscolumns where id=object_id(N'表A') )a
inner join
(
select * from syscolumns where id=object_id(N'表B')
) b
on a.name = b.name
select DISTINCT name from syscolumns where
name in (select name from syscolumns where id in
(select id from sysobjects where name in ('A')))
and
name in (select name from syscolumns where id in
(select id from sysobjects where name in ('B')))
order by name
带表名即可
select a.c,b.c,a.d,b.d from a,b
学习了