Created
May 17, 2013 14:19
-
-
Save Spaider/5599325 to your computer and use it in GitHub Desktop.
Updates membership email from email in racer details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Declare @oldEmail Varchar(100) = '<specify old email here>' | |
Declare @newEmail Varchar(100) | |
Declare @racerID Int | |
Declare @userId Uniqueidentifier | |
Set @userId = (Select am.UserId From aspnet_Membership am Where am.Email Like @oldEmail) | |
Print 'User ID: ' + Cast(@userId As Varchar(45)) | |
Set @racerID = ( | |
Select | |
Cast(Cast(ap.PropertyValuesString As Varchar) As Bigint) | |
From | |
aspnet_Profile ap | |
Where | |
ap.UserId = @userId) | |
If @racerID Is Null | |
BEGIN | |
Print 'Racer not found' | |
Return | |
End | |
Set @newEmail = (Select rd.RCR_Email From vr_t_RacerDetail rd Where rd.RCR_RacerID = @racerID) | |
Print 'Update email from ' + @oldEmail + ' to ' + @newEmail | |
Update aspnet_Membership | |
Set | |
Email = @newEmail, | |
LoweredEmail = Lower(@newEmail) | |
Where | |
UserId = @userId | |
Print 'Done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment