Solved

SQL Server (Update A Query from External File)

Posted on 2013-06-21
2
494 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 66

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 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