开发者

Comparing two tables in SQL Server 2005 using stored procedure

I want to compare the two tables in a same database using stored procedure in SQL Server 2005. If the rows are different, the different row sho开发者_如何学JAVAuld be sent to another table with the particular data. Can any one help me in solving out this? Thanks in advance.

Regards, Gokul.


try

INSERT INTO MyTableDiff
SELECT * FROM
(
(SELECT * FROM MyTable1 EXCEPT SELECT * FROM MyTable2)
UNION
(SELECT * FROM MyTable2 EXCEPT SELECT * FROM MyTable1)
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜