如何比较两个表中有那些字段相同。

我的方法:(很不可取)
1。用SP_help da
---------------------------------------------------------------

select A.name as col, C.name as 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
---------------------------------------------------------------

good way!
---------------------------------------------------------------

'having count(A.name) > 1 '
Good! learning....

Published At
Categories with 数据库类
comments powered by Disqus