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 3 of 5 Topic 11025 of 11422
Post > Topic >>

Re: updating multiple columns with subselect

by "Leif Neland" <leif@[EMAIL PROTECTED] > May 9, 2008 at 09:52 AM

"Dan Guzman" <guzmanda@[EMAIL PROTECTED]
> skrev i en meddelelse
news:VyCUj.15179$V14.7043@[EMAIL PROTECTED]
> > This is not sup****ted in MSsql.
> >
> > update T1 set (theUpdatedValue, theOtherValue) =
> >      (select theTop, theValue from T2 where T2.theKey = T1.theID)
> >
> > Is there a workaround?
>
> You can use the proprietary UPDATE...FROM syntax:
>
> UPDATE T1
> SET
>     theUpdatedValue = T2.theTop,
>     theOtherValue = T2.theValue
> FROM T2
> WHERE
>     T2.theKey = T1.theID
>
Thanks, worked perfectly.

Now I can update my system can be updated, so customers can order stuff
for
both their loved ones, and their wives, without the ordrers getting mixed
up
:-) (I had delivery adress in the customer table, not the order table)

Leif
 




 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 Sun Oct 12 21:13:34 CDT 2008.