IF you run into this error when trying to delete a schema(usually as a result of trying to delete a user that owns a schema)
"Cannot drop schema because it is being referenced by object"
First run this sql to generate the statements that will execute the move
SELECT 'ALTER SCHEMA dbo TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];'
FROM sys.Objects DbObjects
INNER JOIN sys.Schemas SysSchemas ON DbObjects.schema_id = SysSchemas.schema_id
WHERE SysSchemas.Name = 'upstreamgasmgmt'
AND (DbObjects.Type IN ('U', 'P', 'V'))
The previous sql statement will return a set of records like this
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[GetReportPoints];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[mappingTest];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[vwPhysicalZones];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[PantoneStaging_MeasurementVolumes];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[tbl_Volumes_PantonTest];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[test];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[ReportLAUFWellhead];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[November204BidWeek];
Copy and paste that result set into a query window and run it.
Now try and delete the schema again!