I understand that you cannot simply drop an SQL server schema, you must first of all drop all the objects contained therein. I found this stored proc that performs the task of dropping all objects and then the schema itself.
Is there really no simpler way to drop a schema? Ideally, I’d like to find a way to do this without using a stored proc.
Also, it seems like the stored proc will cause errors if the schema name provided does not exist. I would like it to simply do nothing instead. I guess this is simply a matter of putting this pseudocode at the top of the script
IF @SchemaName NOT EXISTS
QUIT
Can someone convert this into language that SQL Server will understand?
You have to remove all objects in the schame before dropping it or migrate all objects to a new schema. There is no “wildcard” option for either
To exit a stored procedure before any further processing…