September 7, 2018 at 9:24 am
Dear All,
I'm currently trying to remove a user who is no longer required to be on the server but I'm receiving the following message "There is a schema that has the same name as the user you are deleting; is it possible to rename the schema or would I have to recreate it completely?
Thank you in advance!
September 7, 2018 at 12:10 pm
tt-615680 - Friday, September 7, 2018 9:24 AMDear All,
I'm currently trying to remove a user who is no longer required to be on the server but I'm receiving the following message "There is a schema that has the same name as the user you are deleting; is it possible to rename the schema or would I have to recreate it completely?
Thank you in advance!
You can't rename a schema so that's not an option.
If it's an empty schema and isn't the default for any users you could drop the schema.
If that's not the case , another option is to rename the user in the database. How you do that depends on if it's a windows or sql account but generally it's just something like: USE YourDatabase
GO
ALTER USER <UserName> WITH NAME = <NewUserName>
GO
And then you could drop the user without the warning.
If there are objects in the schema, you can transfer them to another schema but references to those objects would be different if using two part naming.
Sue
September 7, 2018 at 12:49 pm
tt-615680 - Friday, September 7, 2018 9:24 AMDear All,
I'm currently trying to remove a user who is no longer required to be on the server but I'm receiving the following message "There is a schema that has the same name as the user you are deleting; is it possible to rename the schema or would I have to recreate it completely?
Thank you in advance!
Couldnt you just change ownership of the schema to another DB user or sa and then drop the user?
ALTER AUTHORIZATION ON SCHEMA::[SCHEMANAME] TO [USERNAME]
September 10, 2018 at 8:07 am
Moving the authorization to a new user works.
September 17, 2018 at 3:46 am
Steve Jones - SSC Editor - Monday, September 10, 2018 8:07 AMMoving the authorization to a new user works.
Thank you for the reply! I've changed the owner of the schema; but the issue seems to be with the actual name of the schema where it is named as a particular user which is the one I'm trying to remove.
Thank you
September 17, 2018 at 10:27 am
If you want to rename the schema, you have to essentially drop it and recreate it. However, in your case, with no need to worry about which schema, what I'd do is create a new schema, then use ALTER SCHEMA ... TRANSFER to move the objects from the old user schema to the new one.
September 19, 2018 at 2:56 pm
This was removed by the editor as SPAM
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply