Re-adding AutoTasks to accidentally deleted Tracker in Production database.

Version 1

    Details

     

    This article outlines copying the AutoTasks from a Dev DB in case the loginID was deleted in Production.
    Replace the naming conventions of "Prod" and "Dev" with proper database names.
    This assumes that the LoginID has already been re-created in the Production DB.
    This also assumes that the LoginID was "Admin", this needs to be changed to match the LoginID that was deleted.

     


    Resolution

     

    --  The below statement will pull Development DB AutoTasks into Production based on Owner being 'Admin'.
    INSERT INTO Prod.dbo.HEATSGen 
    (SGCode,SGName,SGAccType,SGOwner,SGCategory,SGCatName,SGType,
    SGOnMenu,SGLastMod,SGCount,SGDetail,SGExpire,SGSFolder)
    SELECT * FROM Dev.dbo.HEATSGen
    WHERE (SGOwner = 'Admin' 
    AND SGCode LIKE 'F%')

    --  The below statement will restore the folder(s) associated to tasks owned by 'Admin'.
    INSERT INTO Prod.dbo.HEATGen (GCode,GName,GType,GDetail,GDTLastMod)
    SELECT * FROM Dev.dbo.HEATGen
    WHERE GName IN (SELECT SGSFolder FROM HEATSGen
    WHERE SGOwner = 'Admin')