Wednesday, August 15, 2012

Change Schema assigned to a User in SQL Server 2008 R2

Yeah, I needed to do this the other day. When I restored a database, the users who came along with it came with their own schemas. I wanted them to be under the dbo schema.

Pretty easy to do. Open Query Analyzer and type:

USE
GO
Alter User With Default Schema = ;
GO

database name = name of the database (duh)
user name = name of the user you want to change the schema for
schema name = name of the scheme you want to user to use

Do this for each user you want to change schema for. Sucks if it's a bunch!

No comments: