Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove or alter the dbo prefix from SQL Server 2012 tables?

Someone already had asked this question here but didn't get an answer for that question .

How can I change a table in SQL Server 2012 that starts with a dbo prefix to one without ?

like image 916
JAN Avatar asked Sep 04 '14 10:09

JAN


People also ask

What is DBO prefix in SQL Server?

"dbo" stands for database owner. It's the default schema created by default in every database. If you don't create another schema, every object is automatically created using the dbo schema. That is, each user in a database has a default schema, and dbo is the default default schema for new users.


2 Answers

Here is the answer (alter !!!) , for anyone that might need it someday :

IF (NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'MyDbo')) 
BEGIN
    EXEC ('CREATE SCHEMA [MyDbo] AUTHORIZATION [dbo]')
END

ALTER SCHEMA MyDbo 
    TRANSFER dbo.your_old_table
GO
like image 174
JAN Avatar answered Nov 15 '22 05:11

JAN


change > mydb.tableName to dbo.tableName

1 .Click F4 or ( view > Properties window) , 2 .then click on your Table. 3 .in properties window , in schema field , change the attribute.

like image 31
Roya Kianbakht Avatar answered Nov 15 '22 05:11

Roya Kianbakht