How to bring missing RCH records into another database, such as in the new school year, after the rollover


Step 1: Back up the table

EXAMPLE:

SELECT * INTO RCH_BACKUP_YYYYMMDD FROM RCH
SQL


Step 2: Find the missing records in the prior year

  • In the destination database, query the source database to identify the missing records

EXAMPLE:

SELECT ID, SCL, YR, TM, TY, GR, REN, RCL, CL, TMD, RPT, DT, GP, UG, LVD, LVE, DEL, DTS
FROM DSTXX000DistrictName..RCH
WHERE SCL = 3
AND TM = 3
AND YR = 2023  
SQL


Step 3: Insert the missing records

  • In the destination database, insert the missing rows from the source database

EXAMPLE:

INSERT RCH (ID, SCL, YR, TM, TY, GR, REN, RCL, CL, TMD, RPT, DT, GP, UG, LVD, LVE, DEL, DTS)
SELECT  ID, SCL, YR, TM, TY, GR, REN, RCL, CL, TMD, RPT, DT, GP, UG, LVD, LVE, DEL, DTS
FROM DSTXX000DistrictName..RCH
WHERE SCL = 3
AND TM = 3
AND YR = 2023
SQL