Using aliases in a subquery

  • Hello helpful chaps of ssc!

     

    Im trying to use a linked server query as a subquery in an update statement and it doesn't like using aliases... so my query looks roughly like:

    Update table x set a =

    (select code from openquery(select b,c,code from table y)) as z

    where z.b = x.b and

    z.c = x.c

    Any thoughts?

    Thanks again!

    Alex

     

  • Update x set x.a = Z.Code from TableX X inner join

    (select code from openquery(select b,c,code from table y)) z

    on z.b = x.b and

    z.c = x.c

  • Well ,you lot have only gone and done it again!

     

    Is this the most helpful forum ever?

     

    Discuss

  • Yes it is .

  • >> The result of the update cannot be determined. The value of the column will depend upon either order of insertion, (if there are no clustered indexes present), or on order of clustering (but only if the cluster isn't fragmented). <<

     

    Of Course if you FORCE to use a non-primary Key join you can't but

     Have you compared the speed of the "Standard" Method against the "Proprietary" one when employed corretly, specially on LARGE Tables ?

     


    * Noel

  • That's gonna be an interesting answer. Let me get some popcorn and coke before you answer that one .

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply