Dumb question update query

  • Sorry guys. Stress and lack of time 😉

     

    But this query doesn't seem to work allthough it's a simple one :

    UPDATE ventven

       SET priori = toer

       FROM TOEROK INNER JOIN ventven

          ON nomat = ship

          WHERE codaff in ('tale','talk','tbre','tdle','tdlk','tdpe','tele','tepe')

     

    Error mssg : Server: Msg 208, Level 16, State 1, Line 1

    Invalid object name 'TOEROK'.

    When open the table TOEROK it shows all data..

    Quid ?

    Thx

    Jeff


    JV

  • Check the owner of TOEROK and change your query to:

    UPDATE ventven

       SET priori = toer

       FROM <tableowner>.TOEROK INNER JOIN <tableowner>.ventven

          ON nomat = ship

          WHERE codaff in ('tale','talk','tbre','tdle','tdlk','tdpe','tele','tepe')

    ..perhaps that will solve it.

    /Kenneth

  • Kenneth

     

    thx for yr quick response

     

    Done that. Even placed database in front of it.

    UPDATE ventven

       SET priori = toer

       FROM epp.dbo.TOEROK INNER JOIN epp.dbo.ventven

          ON nomat = ship

          WHERE codaff in ('tale','talk','tbre','tdle','tdlk','tdpe','tele','tepe')

    ..Same problem though.


    JV

  • UPDATE V

    SET priori = toer

    FROM TOEROK T INNER JOIN ventven V

    ON nomat = ship

    WHERE codaff in ('tale','talk','tbre','tdle','tdlk','tdpe','tele','tepe')

    Apply right aliases to right columns by yourself.

    _____________
    Code for TallyGenerator

  • ok, i have narrowed the problem.

    I can't select the toerok table.

    This is a excel file that has been imported with dts.

    When I open the table I have the data


    JV

  • Try:

    UPDATE ventven

       SET priori = toer

    FROM ventven

       INNER JOIN TOEROK ON ventven.ship = TOEROK.nomat

    WHERE ventven.codaff IN ('tale','talk','tbre','tdle','tdlk','tdpe','tele','tepe')

    I made assumptions for the table.field pairing, so you may need to edit, the main trick is to UPDATE the FROM table.

    Andy

  • This May Help

    update ventven

    set priori= (select toer from toerok on ventven.ship=toerok.nomat)

    WHERE ventven.codaff IN ('tale','talk','tbre','tdle','tdlk','tdpe','tele','tepe')

    Chris

  • You haven't mentioned whether you  have a key in the TOEROK table and that you have SELECT, UPDATE permissions on the table.

Viewing 8 posts - 1 through 7 (of 7 total)

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