patternsqlModerate
Table not getting created under dbo schema
Viewed 0 times
createdgettingschemadboundernottable
Problem
When creating tables in SSMS, I've realized that if you execute the following statement:
the table will be created under your own schema (and not dbo). So in order to create it under the dbo schema, you'll need to explicitly say so, like this:
Does anyone know of a way (eg. server-wide setting) so that when a table is created, the [dbo] part doesn't need to be specified?
CREATE TABLE [tableName];the table will be created under your own schema (and not dbo). So in order to create it under the dbo schema, you'll need to explicitly say so, like this:
CREATE TABLE [dbo].[tableName];Does anyone know of a way (eg. server-wide setting) so that when a table is created, the [dbo] part doesn't need to be specified?
Solution
The schema that will be used when schema is omitted will be the default schema of the database user. Therefore, to have
Server-wide setting? I don't think so. But you could write a query to convert all database users in a particular database to their default schema changed to
dbo schema have the created table without specifying, you'd have to set that database user's default schema to dbo.Server-wide setting? I don't think so. But you could write a query to convert all database users in a particular database to their default schema changed to
dbo if that's what you so choose.Context
StackExchange Database Administrators Q#14296, answer score: 10
Revisions (0)
No revisions yet.