SQL Server 2012: update data from CSV based on primary keys
<p>So I have this table in my database. We'll say it's called <code>users</code>.</p>

<pre><code>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
</code></pre>

<p>And I have this CSV file:</p>

<pre><code>1,"Harry Potter"
4,"Hermione Granger"
3,"Ron Weasley"
</code></pre>

<p>What I want is to update the table from the CSV file. Here's the result I'm looking for:</p>

<pre><code>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
</code></pre>

<p>Without having to write a program to do this, is there a way to accomplish this kind of update from the CSV file? </p>

<p>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 <em>update</em> any columns where the primary key in the database matches the assigned column in the CSV file.</p>

<p>(SQL Server 2012)</p>