SQL Server 2008 r2 join on half a billion records
Posted on 2013-12-19
I need to insert all of the fields from a SQL Server 2008 table (A) where my match field is contained in another table. (B)
I already know the match results will equal 500K records because that is how many table (B) contains and I've consistently matched it to other tables.
I have used a join, where in, where exists, and every other option I can think of with code similar to what I am posting below.
My results keep coming back as 1,200 records and I have no idea why.
Please help me meet a very pressing deadline. All input welcome and appreciated.
Also, the query runs VERY slow, so anything we can put in the code to speed it up will be bonus.
Thanks for helping!
SELECT * into Table3
FROM Table A
Table A, Table B
Table A.matchcolumn=Table B.matchcolumn )