Unable to drop schema 'jobs_internal' because it is being referenced by object 'id_list' in Azure Managed SQL

802 Views Asked by At

I'm trying to export database from Azure and facing various issues.

One or more unsupported elements were found in the schema used as part of a data package. Error SQL71501: Error validating element [jobs_internal].[visible_targets_formatted]: View: [jobs_internal].[visible_targets_formatted] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [jobs_internal].[database_credentials].[C], [jobs_internal].[database_credentials].[name] or [jobs_internal].[targets].

I have deleted all the objects from database, but can not delete schema jobs_internal due to dependancy I can not find.

When I execute

drop schema jobs_internal

I get an error about dependancy enter image description here

When I try to find an object, I receive an empty results enter image description here

Same when I try to find by schema SELECT * FROM sys.objects WHERE schema_id = SCHEMA_ID('jobs_internal')

enter image description here

How to find it and drop it, so I can proceed with export?

2

There are 2 best solutions below

3
On

I also faced similar error while dropping schema.

enter image description here

the reason is schema which we are deleting is also supporting some objects in our database.

To resolve this, you need to find out all objects referenced by the schema "jobs_internal":

SELECT * FROM sys.objects WHERE schema_id = SCHEMA_ID('jobs_internal') 

The objects mentioned in the output must then be moved to the other model or deleted if they are no longer needed. Lastly, the model "user" can be deleted.

1
On
DROP TYPE [jobs_internal].[id_list]