February 15, 2007 by pinaldave
Error 15023: User already exists in current
database.
1) This is the best Solution.
First of all run following T-SQL Query in Query Analyzer. This will return all the existing users in database in result pan.
Run following T-SQL Query in Query Analyzer to associate login with the username. ‘Auto_Fix’ attribute will create the user in SQL Server instance if it does not exist. In following example ‘ColdFusion’ is UserName, ‘cf’ is Password. Auto-Fix links a user entry in the sysusers table in the current database to a login of the same name in sysxlogins.
Run following T-SQL Query in Query Analyzer to associate login with the username. ‘Update_One’ links the specified user in the current database to login. login must already exist. user and login must be specified. password must be NULL or not specified
2) If login account has permission to drop other users, run following T-SQL in Query Analyzer. This will drop the user.
Create the same user again in the database without any error.
First of all run following T-SQL Query in Query Analyzer. This will return all the existing users in database in result pan.
USE YourDBGOEXEC sp_change_users_login 'Report'GORun following T-SQL Query in Query Analyzer to associate login with the username. ‘Auto_Fix’ attribute will create the user in SQL Server instance if it does not exist. In following example ‘ColdFusion’ is UserName, ‘cf’ is Password. Auto-Fix links a user entry in the sysusers table in the current database to a login of the same name in sysxlogins.
USE YourDBGOEXEC sp_change_users_login 'Auto_Fix', 'ColdFusion', NULL, 'cf'GORun following T-SQL Query in Query Analyzer to associate login with the username. ‘Update_One’ links the specified user in the current database to login. login must already exist. user and login must be specified. password must be NULL or not specified
USE YourDBGOEXEC sp_change_users_login 'update_one', 'ColdFusion', 'ColdFusion'GO2) If login account has permission to drop other users, run following T-SQL in Query Analyzer. This will drop the user.
USE YourDBGOEXEC sp_dropuser 'ColdFusion'GOCreate the same user again in the database without any error.
No comments:
Post a Comment