Hi @Coreysan
As a supplement, this is the official documentation for altering a schema.
Best regards,
Percy Tang
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have an internal database, and when I add a new table, I get a problem:
when a record is written to INFORMATION_SCHEMA.TABLES, the column "TABLE_SCHEMA" has the wrong
default schema. Instead of the default "dbo", it is adding my login domain path and name. like this:
"Mydomain\MyName".
Is there a way to reset this to write "dbo"?
Hi @Coreysan
As a supplement, this is the official documentation for altering a schema.
Best regards,
Percy Tang
Hi @Coreysan,
It is very simple.
ALTER SCHEMA dbo TRANSFER [DOMAIN\user].yourtable;
ALTER SCHEMA TargetSchema TRANSFER SourceSchema.TableName;
the column "TABLE_SCHEMA" has the wrong default schema
It's neither the "default" schema nor a wrong one, it's the schema where you created the object/table.
It's the schema where you create the table and if you don't define explicit the schema (already a failure), then the default schema of the surrent user is used.
If you say CREATE TABLE MyTable, the table will be created in your default schema. Which may be dbo or something else. You can review your default schema with this query:
SELECT default_schema_name FROM sys.database_principals WHERE name = USER
To change the default schema, you can use the ALTER USER command.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more