Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I imported a bunch of tables from an old SQL server (2000) to my 2008 database. All the imported tables are prefixed with my username, for example, Jonathan.MovieData. In the table properties, it lists Jonathan as the DB schema. When I write stored procedures I now have to include Jonathan. in front of all the table names which is confusing.

How do I change all my tables to be dbo instead of Jonathan?

Current result: jonathan.MovieData

Desired result: dbo.MovieData

1 Answer

0 votes
by (40.7k points)

You can change all the tables to be dbo instead of jonathan this way:

ALTER SCHEMA dbo TRANSFER jonathan.MovieData;

For more information, you can refer to ALTER SCHEMA

Generalized Syntax is as follows:

ALTER SCHEMA TargetSchema TRANSFER SourceSchema.TableName; 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...