Copy data between rows in the same table

So here was my issue. I needed to copy some <binary data> from one row in a table to another row. I tried using the SQL Server Managment Studio but it does not allow you to copy and past binary information. Instead I used a UPDATE... FROM SQL statement.

Here is an example:

UPDATE LoadTestRun
SET LoadTest = b. LoadTest
FROM LoadTestRun, LoadTestRun b
WHERE LoadTestRun.LoadTestRunID = 4 AND b.LoadTestRunID = 1  

Here is the generic format:

UPDATE table
SET field = b.field
FROM table, table b
WHERE table.PirmaryKeyID = "Copy To ID" AND b.PrimaryKeyID = "Copy From ID"  

Comments

Popular posts from this blog

Add User As Local Administrator On Domain Controller

An error occurred while applying security information to

Display ADFS 2.0 Forms Authentication Login Page Instead of Windows Authentication Prompt