if you want to drop all stored procedures not belonging to the dbo schema from a SQL Server database, you van use the following select statement to generate a list that can be executed to drop the sprocs.

PS: It’s your foot.

 

    select        'drop procedure ' + s.name + '.' + o.name
    from          sys.objects o with (nolock)
    inner join    sys.schemas s with (nolock) on o.schema_id = s.schema_id
    where         o.type = 'P'
    and           s.name <> 'dbo'

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.