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
 Transact-SQL (2005)
 what the easy procedure to do this requirement

Author  Topic 

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-02-19 : 02:28:41
Hi team,I have a requiremnt like below.
IN my database one table contains 5000 rows of data and productid is the unique for this table. I have an excel file with 300 records. Now i want to check how many of these excel file records exist in database table? Through programming we can implement this. is there any possiblity to get things easy than using some programming language?


G. Satish

matty
Posting Yak Master

161 Posts

Posted - 2009-02-19 : 02:51:22
Import the data from excel into a table, and then write a query to get the records that exists in both tables.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-19 : 03:04:22
or use OPENROWSET to get data fromfile and left join with your table to get non existent records (they will return NULL from OPENROWSET query)

http://msdn.microsoft.com/en-us/library/ms190312.aspx
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2009-02-19 : 03:29:10
or import the data into the spreadsheet and use Excel's vlookup function. If it is a one-time thing, you can simply run a query to select the product ids from the database, copy and paste it into the spreadsheet and then run vlookup.
Go to Top of Page
   

- Advertisement -