I have a table called ADSCHL which contains the school_code as Primary key and other two table as RGDEGR(common field as SCHOOl_code) and RGENRl(Original_school_code) which are refrencing the ADSCHL.
If a school_code will be updated, both the table RGDEGR (school_code) and RGERNL ( original_schoolcode) has to be updated as well.
I have been provided a new data that I have imported to SQL server using SSIS with table name as TESTCEP which has a column name school_code. I have been assigned a task to update the old school_code value (ADSCHL) with new school_code (TESTCEP) and make sure the changes happen across all 3 tables.
Can someone please help me with this?
I tried using Merge Update function but wasn't able to do it. It errored out.
I tried using this query and wasn't sure if this is gonna help me to update all the tables:
UPDATE dbo.ADSCHL
SET dbo.ADSCHL.SCHOOL_CODE = FD.SCHOOL_Code
FROM dbo.ADSCHL AD
INNER JOIN TESTCEP FD
ON AD.SCHOOL_NAME = FD.School_Name
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire