3
votes

Diagrams created with Microsoft SQL Server Management Studio have their default schema set to dbo. It seems that there is no way to set another schema when creating a diagram.

For tables,

alter schema NewSchemaName transfer dbo.TableName

moves a specified table to the new schema. But the same command does not work for diagrams.

Is it possible to change the schema once the diagram created?

2

2 Answers

3
votes

No.

Diagrams do not have schemas because they aren't rows/objects in sys.objects.

They have owners but not in the schema/user separation sense.

4
votes

Though diagrams are not attached to schemas, changing the owner will change the "schema" displayed in SSMS.

Change Owner of Database Diagram in SQL Server 2005

As you want to change from "dbo" to another schema, just make sure your destination schema equates to a valid user or role in the database and change the diagram's Principal_ID to match that user's or role's Principal_ID.