How to Change DB Schema to DBO in SQL?
Last Updated :
30 Dec, 2021
In this article, we will look at two methods for changing the database schema in SQL Server to DBO.
Schema:
SQL Schema is defined as a logical grouping of database objects. Tables, views, stored procedures, functions, indexes, and triggers are all part of database object. It is a handy tool for segregating database items for various applications, regulating access privileges, and managing database security management.
Now that we have a fundamental understanding of what schema is let's get started. We have a database called geeks.
Step 1: Use the below SQL statement to switch the database context to geeks:
Query:
USE geeks;
We have a table named brands (Notice: Here the table prefix is GeekSchema indicating that table is under GeekSchema schema).

Step 2: To verify the contents of the table use the below query
Query:
SELECT * FROM
[GeekSchema].brands;

Now let's proceed with changing the table Schema:
Method 1: Using SSMS
Step 1: Right-click on the brands table from the object explorer window and choose Design option:

Step 2: It will opens the table designer window. Wherein we can change table properties. Click on Properties Window

Step 3: Choose the desired Scheme name from the drop down ( dbo in our case)

Step 4: Save the changes by clicking Yes on the confirmation dialogue box. Refresh the tables, we can see the schema of the brands table has been changes from GeekSchema to dbo:
Output:

Method 2: Using SQL Query
Step 1: We can also alter the Table schema using SQL Query. By using the below syntax.
Syntax:
ALTER SCHEMA TargetSchema
TRANSFER SourceSchema.TableName;
Use below query to alter the Schema for brands table.
Query:
ALTER SCHEMA dbo
TRANSFER GeekSchema.brands;

Refresh the tables, we can see the schema of the brands table has been changes from GeekSchema to dbo:
Output:
Similar Reads
How to Change a Column Name in SQL? The ALTER TABLE statement in SQL is a powerful command used to modify the structure of an existing table without affecting its data. It enables changes like adding, dropping, renaming or altering columns in the table. Among these operations, altering a column with the CHANGE or RENAME command is com
3 min read
How to Export Schema Without Data in PL/SQL? In database management, there are times when you need to export the structure of your database objects such as tables, views, and procedures without including the data. This can be useful for creating backups, migrating databases, setting up development or testing environments, or sharing your schem
4 min read
How to Copy Database Schemas without Data in SQL Server Copying database schemas without transferring data is a common requirement in database management, particularly when we need to replicate a database's structure across different environments or instances without the associated content. In SQL Server, a database schema comprises the organization of t
10 min read
Copy a Table from One Schema to Another in SQL? When working with MySQL, there are several scenarios where we may need to copy tables (including their structure and data) from one schema (database) to another. This is a common task during database migrations, backups, or when testing with different environments. In this article, we will go throug
5 min read
How to Show Schema of a Table in MySQL Database? A table schema in MySQL database defines the structure of table, including columns, data types, relationships between columns, etc. It is a blueprint for the table, describing how data is organized in the table and how it relates to other tables in the database. To see the schema of a table in MySQL
2 min read