Hi,
Create Schema.TableName (No Problem)
Create Schema1.schema2.TableName (Problem SQL see schema1 as the database)
Create Database,schema1.schema2.TableName (Error below)
Msg 117, Level 15, State 1, Line 13
The object name 'DatabasName.Schema1. Schema2.TableName' contains more than
the maximum number of prefixes. The maximum is 2.
Msg 319, Level 15, State 1, Line 84
Incorrect syntax near the keyword 'with'. If this statement is a common
table expression or an xmlnamespaces clause, the previous statement must be
terminated with a semicolon.
"Aaron Bertrand [SQL Server MVP]" wrote:
> Can you show the ACTUAL syntax you tried, and the EXACT error message?
> The syntax you show demonstrates two options:
> CREATE TABLE master.schema1.table
> CREATE TABLE schema1.table
> It sounds like you maybe misinterpreted it as:
> CREATE TABLE master.schema1.schema2.table
> ?
>
>
>> Create Schema1.schema2.TableName (Problem SQL see schema1 as the database)
Yes, because you can't nest schemas.
> Create Database,schema1.schema2.TableName (Error below)
You still can't nest schemas. A schema can't own a schema, there is only
one "level" for it in the heirarchy.|||You can nest schemas according to the syntax. Do you claim the syntax is wro
ng?
Syntax
CREATE TABLE
[ database_name . [ schema_name ] . | schema_name . ] table_name
"Aaron Bertrand [SQL Server MVP]" wrote:
> Yes, because you can't nest schemas.
>
> You still can't nest schemas. A schema can't own a schema, there is only
> one "level" for it in the heirarchy.
>
>|||> You can nest schemas according to the syntax. Do you claim the syntax is
> wrong?
> Syntax
> CREATE TABLE
> [ database_name . [ schema_name ] . | schema_name . ] table_name
No, the syntax is not wrong. Your interpretation of the syntax is wrong, as
several people have already pointed out.
The syntax says you can do:
CREATE TABLE databasename.schemaname.tablename
or
CREATE TABLE schemaname.tablename
or
CREATE TABLE tablename
[[this.that]|or this but not both.]tablename
Go ahead and file a bug that the documentation is wrong as per your
interpretation. But the following fact remains the same: YOU CANNOT NEST
SCHEMAS, EVEN IF YOU INTERPRET THE DOCUMENTATION INCORRECTLY.|||I think you only have to change the parameter from 2 to 3 (Error message),
and we are fine.
I found 1 person by searching the Internet who had the error 3, who tried to
write 3 schemas by including dbo in his syntax...
Thank you,
Rune
"Aaron Bertrand [SQL Server MVP]" wrote:
> No, the syntax is not wrong. Your interpretation of the syntax is wrong,
as
> several people have already pointed out.
> The syntax says you can do:
> CREATE TABLE databasename.schemaname.tablename
> or
> CREATE TABLE schemaname.tablename
> or
> CREATE TABLE tablename
> [[this.that]|or this but not both.]tablename
> Go ahead and file a bug that the documentation is wrong as per your
> interpretation. But the following fact remains the same: YOU CANNOT NEST
> SCHEMAS, EVEN IF YOU INTERPRET THE DOCUMENTATION INCORRECTLY.
>
>|||>I think you only have to change the parameter from 2 to 3 (Error message),
> and we are fine.
> I found 1 person by searching the Internet who had the error 3, who tried
> to
> write 3 schemas by including dbo in his syntax...
Now I have absolutely no idea what you are talking about.
In summary: YOU CANNOT NEST SCHEMAS.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment