Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Rookie Question - Crossreference SQL table to XLS

Author  Topic 

joecbrown
Starting Member

1 Post

Posted - 2011-06-24 : 16:02:36
I have a users table in SQL 2005 with a million records which I only have read only access to. I was recently given a csv file that includes some 400,000 rows. I need to see which if any of the records in the csv match the records in our DB. I plan to match on First Name, Last Name, and Address. What is the best approach to do this in SQL 2005.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-25 : 10:26:20
I would pretty much rule out being able to do this in Excel because of the number of rows involved. That leaves doing it in SQL as your only option.

Even if you have read-only access to the specific table, if you are able to create other tables in the same SQL database or on the same server, import the csv file into the database (SSIS or import wizard can be used to do this) and then write a query to compare your data against the data in the read-only table.


With a million records, if the read-only table does not have proper indexes, you may find that your query would be very slow.
Go to Top of Page
   

- Advertisement -