Stored Procedure to compare two tables

Posted by Gokul under Sql Server on 8/23/2011 | Points: 10 | Views : 5001 | Status : [Member] | Replies : 4
Dear Friends,
I want to compare the two tables in the same DB in the same server using stored procedure in sql server 2005. The result of the stored procedure should contains the different columns and the values and its result should be written to another table with the comparision details.




Regards,
Gokul.

Thanks and Regards,
GokulNath Nithy.



Responses

Posted by: PandianS on: 8/23/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi

You can use TableDiff.exe utility

http://msdn.microsoft.com/en-us/library/ms162843(v=sql.90).aspx

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Gokul, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: ttarakarajesh-8732 on: 8/23/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

I think this link http://stackoverflow.com/questions/1722846/use-tablediff-to-compare-all-tables is helpful to you, to compare all tables

Gokul, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 10/27/2011 [Member] Starter | Points: 25

Up
0
Down

create procedure sp_compare
as
select * from employee ,employeedetails where employee.empid=employeedetails.empid
Go

hope this will help

let me know any questions

Regards
Sriram.R

sriram

Gokul, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 11/24/2011 [Member] Starter | Points: 25

Up
0
Down
create procedure sp_Products
@product_id int,
@productname varchar(90),
@productprice money
as
begin
select * from product_Details inner join product_price
on product_Details.productid=product_price .productid where productid=@product_id


hope this will help

Regards
Sriram.R

sriram

Gokul, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response