|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, December 13, 2012 10:39 AM
Points: 17,
Visits: 77
|
|
I restored a database dump to a new instance in my test environment. I created a login and tried to map it to an existing user in the database, however when I try to do so I get an error:
Rename failed for User 'Username', (Microsoft.SqlServer.Smo) An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
User, group, or role 'user' already exists in the current database. (Microsoft SQL Server, Error: 15023).
When I try to delete the user, I also get an error:
Drop failed for User 'Username', (Microsoft.SqlServer.Smo) An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138).
Please help.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Wednesday, August 17, 2011 7:09 AM
Points: 869,
Visits: 963
|
|
| Since the user owns a schema in the database, you need to find which schema it owns and change ownership, then the user can be dropped.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, December 13, 2012 10:39 AM
Points: 17,
Visits: 77
|
|
|
|
|