Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to have the results of a query that will compare 2 different database tables and show the records of one table that don't have the same value in field 'name'
eg table1/database1 fields id,name,address,phone
table1/database2 (same SQL local Server) fields id, name, date
I want to have in a reader (ado) the records of table1/database1 where field 'name' values doesn't exist in table1/database2 can be done in one Connection command.text? or I have to find the values store them eg dataview and then compare them?
Posted
Comments
Tomas Takac 5-Jun-15 4:29am    
This doesn't seem complicated. What have you tried?
Member 3892343 5-Jun-15 5:54am    
nothing yet I think I will add the records to Temporary data tables and compare them not too good with SQL queries but I will google it "select name from etc." to find something, if you know a query that do this comment it but I thing it will need 2 ado Connection strings, right?

1 solution

as long as both databases are in the same instance its straight forward in an SSMS query...

select * from [dbase1].dbo.table as t1
join [dbase2].dbo.table as t2 on t1.uniqueid = t2.uniqueid
 
Share this answer
 
Comments
Member 3892343 7-Jun-15 16:08pm    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900