[转载]如何取得两个表相同的列名
信息来源:黑基写的真不错,大家可能用到 。
找出表a1,a2相同的列名:
select left(A.name, 20) col, left(C.name,20) type, A.length from
syscolumns A left join sysobjects B
on A.id = B.id left join systypes C
on A.xtype = C.xtype
where B.name = 'a1' or B.name = 'a2'
group by A.name, C.name, A.length
having count(A.name) > 1
go
页:
[1]