Is it possible to change the LoginID value for a user throughout the entire HEAT database?

Version 1

    Details

    People need to have the Tracker (LoginID value) changed due to marital status or process changes like first initial and last name to a full name value. If this information is just altered at the Tracker table level then all history for that original LoginID will be lost. This includes Call Ticket information, Call Groups, AutoTasks etc. Is there a way to populate the new LoginID for a person throughout the HEAT database so as not to lose any historical data associated to that user?


    Resolution

    1.  Back up the HEAT database prior to running any UPDATE SQL statements as there is no roll back process.

    2.  Run the following in SQL Server Management Studio substituting the proper "new" and "old" LoginID values:

    DECLARE @NewLogin  char(96), 
                       @OldLogin    char(96) 
    SET           @NewLogin = 'Enter_New_LoginID'           -- Enter New Login name 
    SET           @OldLogin = 'LoginID_To_Be_Replaced'      -- Enter Old Login name 

    -- CallLog Table -- 

    UPDATE  CallLog 
    SET     Tracker = @NewLogin 
    WHERE   Tracker = @OldLogin 

    UPDATE  CallLog 
    SET     ClosedBy = @NewLogin 
    WHERE   ClosedBy = @OldLogin 

    UPDATE  CallLog 
    SET     RecvdBy = @NewLogin 
    WHERE   RecvdBy = @OldLogin 

    UPDATE  CallLog 
    SET     ModBy = @NewLogin 
    WHERE   ModBy = @OldLogin 


    -- Profile --

    UPDATE  Profile 
    SET     ModBy = @NewLogin 
    WHERE   ModBy = @OldLogin

    -- Asgnmnt Table -- 

    UPDATE  Asgnmnt 
    SET     LoginID = @NewLogin 
    WHERE   LoginID = @OldLogin 

    UPDATE  Asgnmnt 
    SET     AssignedBy = @NewLogin 
    WHERE   AssignedBy = @OldLogin 

    UPDATE  Asgnmnt 
    SET     WhoAcknow = @NewLogin 
    WHERE   WhoAcknow = @OldLogin 

    UPDATE  Asgnmnt 
    SET     WhoResolv = @NewLogin 
    WHERE   WhoResolv = @OldLogin 

    -- Journal Table -- 

    UPDATE  Journal 
    SET     Tracker = @NewLogin 
    WHERE   Tracker = @OldLogin 

    -- Assignee Table -- 

    UPDATE  Assignee 
    SET     LoginID = @NewLogin 
    WHERE   LoginID = @OldLogin 

    -- Team Mems Table -- 

    UPDATE  TeamMems 
    SET     LoginID = @NewLogin 
    WHERE   LoginID = @OldLogin 

    -- HEATActv Table -- 

    UPDATE  HEATActv 
    SET     UserName = @NewLogin 
    WHERE   UserName = @OldLogin 

    -- HEATGen Table -- 

    UPDATE  HEATGen 
    SET     GName = @NewLogin 
    WHERE   GName = @OldLogin 

    -- HEATGrp Table -- 

    UPDATE  HEATGrp 
    SET     Tracker = @NewLogin 
    WHERE   Tracker = @OldLogin 

    UPDATE  HEATGrp 
    SET     Owner = @NewLogin 
    WHERE   Owner = @OldLogin 

    -- HEATHot Table -- 

    UPDATE  HEATHot 
    SET     HotOwner = @NewLogin 
    WHERE   HotOwner = @OldLogin 

    UPDATE  HEATHot 
    SET     WhoAdded = @NewLogin 
    WHERE   WhoAdded = @OldLogin 

    -- HEATMail Table -- 

    UPDATE  HEATMail 
    SET     ToWho = @NewLogin 
    WHERE   ToWho = @OldLogin 

    UPDATE  HEATMail 
    SET     FromWho = @NewLogin 
    WHERE   FromWho = @OldLogin 

    -- HEATMsg Table -- 

    UPDATE  HEATMsg 
    SET     MTo = @NewLogin 
    WHERE   MTo = @OldLogin 

    UPDATE  HEATMsg 
    SET     MFrom = @NewLogin 
    WHERE   MFrom = @OldLogin 

    -- HEATSGen Table -- 

    UPDATE  HEATSGen 
    SET     SGOwner = @NewLogin 
    WHERE   SGOwner = @OldLogin 

    -- HEATLock Table -- 

    UPDATE  HEATLock 
    SET     Tracker = @NewLogin 
    WHERE   Tracker = @OldLogin 

    -- HEAT Tracker Table -- 
    -- Only use update on this table if you haven''t created the New Login in the Tracker table 
     UPDATE       Tracker 
     SET          LoginID = @NewLogin 
     WHERE        LoginID = @OldLogin