View Single Post

   
  #3 (permalink)  
Old 05-10-2008, 03:12 PM
Plamen Ratchev
 
Posts: n/a
Default Re: updating multiple columns with subselect

On SQL Server 2005 you can use CTE to perform the update:

WITH UpdateSet
AS
(SELECT theUpdatedValue, theOtherValue, theTop, theValue
FROM T1
JOIN T2
ON T1.theID = T2.theKey)
UPDATE UpdateSet
SET theUpdatedValue = theTop,
theOtherValue = theValue;

HTH,

Plamen Ratchev
http://www.SQLStudio.com
Reply With Quote