Lauren,
Thanks. I tried that and it works great. It also only accesses each
table once, so it's a good solution.
Thanks and Best Regards,
Chuck Conover
www.TechnicalVideos.net
"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
news:47e5bd72.0401271831.16018a75@posting.google.c om...[color=blue]
> Chuck,
> I did find a solution for your bag of tricks:
>
> Alter Procedure "mySPName"
> As
> set nocount on
> UPDATE
> tblName
> SET
> tblName.FieldOne = tblNameTEMP.FieldOne,
> tblName.FieldTwo = tblNameTEMP.FieldTwo,
> tblName.FieldThree = tblNameTEMP.FieldThree,
> FROM
> tblNameTEMP
> WHERE
> tblName.UniqueID = tblNameTEMP.UniqueID
>
>
> lq
>
>
>
>
>
>
> "Chuck Conover" <cconover@commspeed.net> wrote in message[/color]
news:<1075236614.188548@news.commspeed.net>...[color=blue][color=green]
> > Lauren,
> > That's an interesting update. I've never done an update with a JOIN[/color][/color]
in[color=blue][color=green]
> > it before and, out of curiosity, I tried to make it work, but was
> > unsuccessful.
> > The way I would normally do this in an SP would be like this:
> >
> > create procedure update_mytable as
> > begin
> > UPDATE tblMyTable
> > set myField = (select t.myField from tblMyTableTemp t where t.UniqueID[/color][/color]
=[color=blue][color=green]
> > tblMyTable.UniqueID),
> > myField2 = (select t.myField2 from tblMyTableTemp t where t.UniqueID =
> > tblMyTable.UniqueID),
> > myField3 = (select t.myField3 from tblMyTableTemp t where t.UniqueID =
> > tblMyTable.UniqueID)
> > end
> >
> > Since my solution requires 3 trips to tblMyTableTemp, if anyone knows[/color][/color]
how to[color=blue][color=green]
> > do this update in a similar fashion to the way Lauren did it below, pls
> > advise. I'd love to add that to my "bag o' tricks".
> >
> > Thanks and Hope that helps.
> > Chuck Conover
> >
www.TechnicalVideos.net
> >
> >
> >
> >
> > "Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
> > news:47e5bd72.0401271014.6a478253@posting.google.c om...[color=darkred]
> > > In VBA, I constructed the following to update all records in
> > > tblmyTable with each records in tblmyTableTEMP having the same
> > > UniqueID:
> > >
> > > UPDATE
> > > tblMyTable RIGHT JOIN tblMyTableTEMP ON tblMyTable.UniqueID =
> > > tblMyTableTEMP.UniqueID
> > > SET
> > > tblMyTable.myField = tblMyTableTEMP.myField,
> > > tblMyTable.myField2 = tblMyTableTEMP.myField2,
> > > tblMyTable.myField3 = tblMyTableTEMP.myField3
> > >
> > > How is this done in a SQL Server Stored Procedure?
> > > Any help is appreciated.
> > > lq[/color][/color][/color]