1. Error while calling the Roles.AddUserToRole
If you have membership role issue in ASP.NET, you need to check whether the stored procedure 'aspnet_UsersInRoles_AddUsersToRoles' is still present after the database replication. Due to the collation conflict, it may be not copied to the new database server following migration. Here is the example of the error message:
I tried to run the script on the new database server and got the following error:
Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 49
Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
I resolved this collation issue this way:
In aspnet_UsersInRoles_AddUsersToRoles, change
Code:DECLARE @tbNames table(Name nvarchar(256) NOT NULL PRIMARY KEY)
to
Code:DECLARE @tbNames table(Name nvarchar(256) COLLATE Latin1_General_CI_AS NOT NULL PRIMARY KEY)
Find what collation you are using in your database and use it.
I found the following change didn't work for me:
Code:DECLARE @tbNames table(Name nvarchar(256) COLLATE DATABASE_DEFAULT NOT NULL PRIMARY KEY)