Dual Database Query

  • I apologize if this is the wrong forum, but here is my question

    I am trying to update a table in one database with information from a table in a different database.

    The login I have will work in both databases so this should not be the issue. Here is the statement:

    Update ptr34..mainframedataconversion

    SET

    ethnicity = ptr22..tblvalue.Ethnicity,

    race = ptr22..tblvalue.Race,

    email = ptr22..tblvalue.Email

    where ptr34..mainframedataconverterclaimant.ssn = ptr22.dbo.tblvalue.ssn

    GO

     

    I have also tried the following:

    ptr22.dbo.tblvalue.Ethnicity

    both give the following errors:

    Server: Msg 107, Level 16, State 3, Line 1

    The column prefix 'ptr22.dbo.tblvalue' does not match with a table name or alias name used in the query.

    Any help is appreciated

     

  • Hello Mark,

    Can you try this one

    Update mainframedataconversion

    SET ethnicity = ptr22.Ethnicity,

    race = ptr22.Race,

    email = ptr22.Email

    from mainframedataconvertclaimant ptr34, tblvalue ptr22

    where ptr34.ssn = ptr22.ssn

    Thanks and have a nice day!!!


    Lucky

  • This issue is resolved.

    I needed to add an alias to the query for some reason.

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

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