May 19, 2008 at 7:46 am
Hello,
I've restored a backup of production production database to my development box for the first time since we've upgraded to SQL 2005. There's a "MyUser" account that's used by my application to connect to the database. When I restore the database it doesn't really point to a valid user account in the system.
In SQL 2000 it was pretty simple to delete the user from the database and recreate it, pointing it to the correct existing user account. When I try to delete the user in SQL 2005, I get the following message:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Drop failed for User 'MyUser'. (Microsoft.SqlServer.Smo)
------------------------------
ADDITIONAL INFORMATION:
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)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=15138&LinkId=20476
Is there a work around for this?
-Eric
May 19, 2008 at 8:48 am
You should read up on sp_change_users_login stored procedure.
"Got no time for the jibba jabba!"
-B.A. Baracus
May 19, 2008 at 8:48 am
The user owns an object, in this case, a schema.
Move the schema to a new user and then drop this one.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply