none
Update Production Table From Staging RRS feed

  • Question

  • I have a production table called 'County2' with the following columns:

    CountyID (identity),
    [Name],
    StateID,
    Elevation

     

    I need to update any changes to [name], StateID, and Elevation from another table called County2_Staging.

     

    The CountyID column has been used as the primary key. I'm a little concerned about using this to update records from the staging table to County2.

     

    I know that I could identify the changed records from staging like this:

     

    select ct.[name], ct.StateID, ct.Elevation from county2_staging ct
    left outer join county2 cs
    on ct.[name] = cs.[name]
    and ct.StateID = cs.StateID
    and ct.Elevation = cs.Elevation
    where cs.[name] is null

     

    Is there a way that I can update county2 without using the identity column?

     

    Thank you for your help

     

    cdun2

     

    Monday, September 8, 2008 8:44 PM

Answers