Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > Re: updating mu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 11025 of 11517
Post > Topic >>

Re: updating multiple columns with subselect

by "Plamen Ratchev" <Plamen@[EMAIL PROTECTED] > May 8, 2008 at 09:37 AM

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
 




 5 Posts in Topic:
updating multiple columns with subselect
"Leif Neland" &  2008-05-08 12:36:13 
Re: updating multiple columns with subselect
"Dan Guzman" &l  2008-05-08 07:42:28 
Re: updating multiple columns with subselect
"Leif Neland" &  2008-05-09 09:52:29 
Re: updating multiple columns with subselect
"Plamen Ratchev"  2008-05-08 09:37:43 
Re: updating multiple columns with subselect
--CELKO-- <jcelko212@[  2008-05-12 13:00:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 1:07:14 CST 2008.