Merging User Accounts Script (CS 2.1, SQL)
Thu, Mar 22 2007
Downloads: 273
File size: 3.6kB
Views: 1,829
 |
Merging User Accounts Script (CS 2.1, SQL) |
The purpose of this script is to merge two existing user accounts into a single account with an option to change the username once the merge has been successful. This script is specifically for Community Server 2.1.
Before executing the script, there are 3 variables which will need to be set.
@CurrentUserName - The username of the current (active) account.
SET @CurrentUserName = 'John Smith'
@PreviousUserName - The username of the previous (old) account being merged into the current account.
SET @PreviousUserName = 'John Doe'
@DesiredUserName - The username the current account should use and/or be renamed as.
SET @DesiredUserName = 'John Smith'
Known Issues / Limitations:
- Many of the records associated with a user's account will be merged with this process. For example, the previous account's favorites will be attached to the to current account unless they've already been marked as favorites by the current account in which case they're deleted.
- The previous account's profile information will not be merged into the current account.
- The previous account's avatar will not be merged, regardless if the current account has an avatar or not.
- The previous account's assigned roles are not merged. If there are any roles the previous account was assigned to that the current account is not assigned to, they will have to be manually added by the administrator.
- The Notes field of the cs_ModerationAudit table is not checked for usernames and will not be updated by this script.
- The EditNotes field of the cs_PostEditNotes table is not checked for usernames and will not be updated by this script.
- The post body (messages) will not be checked for usernames and will not be updated by this script. This applies to cases where the user has been quoted and/or another user has referred to that user within their post.
- This script was written for Community Server SP1, ASP.Net 2.0 schema. There were additional tables added for the ASP.Net 2.0 version but only one that would be affected by merging accounts. There is a check to see if the table exists so it shouldn't matter which version of ASP.Net you use for Community Server. Also, the script was written and tested on SQL Server 2000 so I can't 100% guarantee that it works on SQL Server 2005.
Also, if you are running more than one installation of CS within the same
database and not sharing the users, then please be aware that this script does not include the applicationId or settingsId.
Updated 03/23/2007: Replaced the portion of the script that dealt with changing usernames (optional) by using the stored procedure for renaming users.