So I have this table in my database. We'll say it's called users
.
UserID UserName UserDescription
-----------------------------------
1 test1 Test User #1
2 test2 Test User #2
3 test3 Test User #3
4 test4 Test User #4
5 test5 Test User #5
And I have this CSV file:
1,"Harry Potter"
4,"Hermione Granger"
3,"Ron Weasley"
What I want is to update the table from the CSV file. Here's the result I'm looking for:
UserID UserName UserDescription
-----------------------------------
1 test1 Harry Potter
2 test2 Test User #2
3 test3 Ron Weasley
4 test4 Hermione Granger
5 test5 Test User #5
Without having to write a program to do this, is there a way to accomplish this kind of update from the CSV file?
Basically I want to do something like what you can do in the Import Data wizard - map the CSV columns to their respective database columns - but to have the database update any columns where the primary key in the database matches the assigned column in the CSV file.
(SQL Server 2012)