UPDATE Name field

  • I have 2 tables as ahown below:

    tbl_DEMOG1

    PATID Name DOB Post code

    NH4537 Smithe, James 12/07/1979 Se25 6xu

    NH4638 Thomass, David 11/05/1978 sw15 typ

    tbl_DEMOG2

    PATID Name DOB Post code

    NH4537 SMITH JAMES 12/07/1979 Se25 6xu

    NH4638 THOMAS, DAVID 11/05/1978 sw15 typ

    I need to update the Name column in tbl_DEMOG1 so that it is inthe same format as the name column in tbl_DEMOG2 where the PATID is the same. I need this for 2 reasons as the some of the names are spelt incorrectly in tbl_DEMOG1 and the format for the output needs to be in upper case.

  • That would just be an update statement with a join:

    UPDATE tbl_DEMOG1

    SET Name = D2.Name

    FROM tbl_DEMOG1

    INNER JOIN tblDEMOG2 D2 ON tblDEMOG1.PatID = D2.patID

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

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

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