[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SQL Server (Update A Query from External File)

Posted on 2013-06-21
2
Medium Priority
?
506 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 66

Accepted Solution

by:
Jim Horn earned 2000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

834 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