multi update link server problem

  • how to use multi update i link server

    in one connection !!!!

    how

    ---------------

    UPDATE [pitable].[dbo].[allpi]

    SET val1 = (SELECT *

    FROM OPENQUERY(pcnh, 'SELECT value as ro1    FROM picomp  WHERE time = date(''*'') AND tag = ''rt1mp001''

    set val2= ' SELECT value as ro1    FROM picomp  WHERE time = date(''*'') AND tag = ''rt1mp001''

    set val3= 'SELECT value as ro1    FROM picomp  WHERE time = date(''*'') AND tag = ''rt1mp001''

     

    '))

    ----------------

    thnks ilan

  • Errr. that's very not right. Perhaps you want something like:

     

    UPDATE TableA

    SET val1 = valueX,

          val2=  valueY,

          val3= valueZ

    FROM TableA

    JOIN (SELECT *

             FROM OPENQUERY(linkedserver, 'SELECT valueX, valueY, valueZ   FROM picomp  WHERE time = date(''*'') AND tag = ''rt1mp001'' ')

       AS TableB

     ON TableA.somecolumn = TableB.somecolumn

     

     


    Julian Kuiters
    juliankuiters.id.au

  • i is not ok

    my problem is this

    ------------------------

    --1----v-1-----------

    UPDATE [pitable].[dbo].[allpi]

    SET val1 = (SELECT *

    FROM OPENQUERY(pcnh, 'SELECT value as ro1    FROM picomp  WHERE time = date(''*'') AND tag = ''rt1mp001''

     

    '))

    --2----v-2-------

    UPDATE [pitable].[dbo].[allpi]

    SET val2 = (SELECT *

    FROM OPENQUERY(pcnh, 'SELECT value as ro2    FROM picomp  WHERE time = date(''*'') AND tag = ''rt2mp001''

     

    '))

    --3-------v-3-------

    UPDATE [pitable].[dbo].[allpi]

    SET val3 =(SELECT *

    FROM OPENQUERY(pcnh, 'SELECT value as ro3    FROM picomp  WHERE time = date(''*'') AND tag = ''rt3mp001''

     

    '))

    ---------------------- and more 30 updates

    i need one connection from the link server

    thnks ilan

Viewing 3 posts - 1 through 2 (of 2 total)

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