Lesson Learned #54: The specified schema name name@domain.com either does not exist or you do not have permission to use it
Published Mar 13 2019 07:35 PM 9,462 Views
First published on MSDN on Jan 13, 2019
Hello Team,

Some days ago, I worked in a very interesting service request.

Our customer created a Azure Active Directory group adding two members and they added this group as db_owner role of the database.

The first member of this group is able to create tables without problems  using CREATE TABLE TableExample (id int) but the second or others ones are not able and they are facing the following error: Msg 2760, Level 16, State 1, Line 1 [The specified schema name name@domain.com either does not exist or you do not have permission to use it.]

It seems that starting the second member of the group, the default schema that SQL Engine is using is the user account not dbo.

In order to mitigate the issue, we have two solutions:

  • Specify the schema name in the name of the table , like this one: CREATE TABLE dbo.TableExample (id int) every member of the group are able to without problem.

  • Specify the schema default name at the moment of the creation of the group using the default_schema option.


Enjoy!
2 Comments
Copper Contributor

Hello @Jose_Manuel_Jurado , having encountered the issue you described, I am wondering: how can I inspect the default_schema of an existing Active Directory group?

I work with a couple of Azure SQL databases tied to different directories. In one of these databases, when I 'select SCHEMA_NAME()' I see 'dbo' while in the other the same query returns 'null'. However, when I look at the default_schema_name column of the relevant Active Directory groups in sys.database_principals, it is 'null' in *both* cases. This has me rather confused!

Copper Contributor

I have the same issue while executing `CREATE SCHEMA myNewSchema`, which you can obviously not prefix with the schemaname `dbo`.

Version history
Last update:
‎Mar 13 2019 07:35 PM
Updated by: