Solved

SQL Server (Update A Query from External File)

Posted on 2013-06-21
2
488 Views
Last Modified: 2013-06-22
Below I have a SQL Server Query where I am looking to return the Customer Name and Address for the specified CustomerID's.  
I have to run this query on a regular basis.  However,  each time I run this I have to insert a long list of customer ID's into the query from an Excel spreadsheet.  It's get to be time consuming as the list of CustomID's changes each time I need to run this query.  I am looking for method where I can speed things up or automate the process of pointing the query at this list of customerID's that are stored in the Excel Spreadsheet. Thanks for any feedback.
--Query
Select CustomerName, Address
from Customers
WHERE CustomerID in ('12345', 12346', '12347')
0
Comment
Question by:fjkaykr11
2 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39267268
I'd consider ...

building a table to hold these ID's
Build an ETL or BULK INSERT to delete all from the table, then import the ID's from the Excel spreadsheet into that table.  Then  
Change the query so that it JOINS on the new table, like...

Select CustomerName, Address
from Customers
   JOIN YourNewTable ON Customers.CustomID = YourNewTable.CustomID

Open in new window

0
 
LVL 3

Author Closing Comment

by:fjkaykr11
ID: 39268782
thanks appreciate the info.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question