SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Update one column of a table with data from another table


Update one column of a table with data from another table

Author
Message
Van Heghe Eddy
Van Heghe Eddy
SSC Eights!
SSC Eights! (871 reputation)SSC Eights! (871 reputation)SSC Eights! (871 reputation)SSC Eights! (871 reputation)SSC Eights! (871 reputation)SSC Eights! (871 reputation)SSC Eights! (871 reputation)SSC Eights! (871 reputation)

Group: General Forum Members
Points: 871 Visits: 900
Hi,

Try this one


UPDATE bck
SET bck.ProcID = ori.ProcID
FROM dbo.BlogCopy_copy as bck inner join dbo.BlogProcedures as ori
on bck.WebID=ori.WebID



Using aliasses of tables is a good habit that you really should learn to use :-)

Wkr,
Van Heghe Eddy
Hans K
Hans K
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 17
Thanks for the tip - I did manage to find out why it did not work, I needed to use an additional "WHERE" qualifier.

I also agree with the alias suggestion, but my main platform for development is web based and I use DreamWeaver for that. Using aliases tends to mess with the built in SQL builder, so I have never really spent too much time getting to use aliases.

Thanks
Hans
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search