Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I update existing SQL table data from a .csv file using an update query statement containing path of the file?

Posted on 2007-11-26
3
Medium Priority
?
1,162 Views
Last Modified: 2013-11-24
I am using SQL Express mgmt studio along with DTS for import/export of data....

I have an SQL table called Table1 and I want to update it with data from an Excel file called 'NewData' located at C:\NewData.csv

The file 'NewData' contains a column variable named 'IDNUMBER' and Table1 also contains this variable column called IDNUMBER. I want to update each record/row of data in Table1 with the data from the 'NewData.csv' file where the IDNUMBERS match.

All variable names/headers in NewData.csv also exist in Table1, so the mapping is direct and simple... I just need some help with the statement and integration of the path to the NewData.csv file to get this thing working...any help is really appreciated.
0
Comment
Question by:jazjef
[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
3 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 20353019
0
 
LVL 17

Accepted Solution

by:
pssandhu earned 2000 total points
ID: 20353170
Or, you can just use the import/export wizard to load the data from the csv file into a table in your db and then link Table1 to the table that you just made and do an update.
0
 
LVL 4

Author Comment

by:jazjef
ID: 20354938
Good ideas guys. I had a hunch that the 'import to a new table and then update' might work.... This appears to be the most feasible method at the moment. The UPDATE option gives me flexibility and its really easy via DTS to get the data into a new temp table.....

I had no knowledge of the 'bulk insert' .... that's an interesting idea. Does 'bulk insert' simply insert the whole file or can I specify that the insert occur where the IDNUMBER matches etc? The link doesn't really say.....
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

636 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