Updates from table to table

  • Another sure sign I have spent too much time using the cheats in access. I'm trying to do an update to a table based on the contents in another table:

    Update ecourt.dbo.EC_D_Doc inner join Export

    on Export.Document_ID = ecourt.dbo.EC_D_Doc.DocRef set

    D.DateDoc =E.DateDoc ,

    D.DateGuess =E.DateGuess ,

    D.DocRef =E.DocRef ,

    D.DocDesc =E.DocDesc ,

    D.DocTitle =E.DocTitle ,

    D.DateModified =getdate() ,

    which works fine in Access as it can resolve back to the required tables (although I admit I haven't tried it in access and may go do so in a second to ensure I haven't just made a bad typo).

    I'm sure I'll figure a way around this in sql, but what is the usual / best method of doing this?

  • The syntax is

    UPDATE EC_D_DOC SET

    DateDoc = E.DateDoc,

    ....

    FROM EXPORT E

    WHERE EC_D_DOC.DocRef = E.Document_ID

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

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