开发者

Using temporary tables to store data from Excel file

I've got a database with information on servers and applications. I also have an Excel file which has some of that information saved in it . 开发者_开发技巧 What I'm trying to do is compare the database with the Excel file and output all the results which are present in the DB and not the Excel file, and vice versa.

After some thinking, I decided that it might be best to create temporary tables and save all the data from the Excel file into them, and then do an outer join between the corresponding tables (I'm using SQL Server).

How do I go about doing this without creating models in Rails for them (unless I specifically have to create them)?

Not sure how to use raw SQL in this instance =s


You actually have several choices on how to import the Excel data. If you're looking for a strictly SQL Server solution then you can use a linked server or distributed queries. You can also use DTS/SSIS (depending on your version of SQL Server) for a solution that's external. You could call the SSIS or DTS packages from your own code. Excel also has an OLE DB provider, so if your application uses ADO or otherwise uses OLE DB then you can use that.

All of these methods are explained in a little more detail on Microsoft's website, including some sample code for some of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜