I'm working on versioning our database and now searching for a way to drop all stored procedures and functions from a C# Console Application. I'd rather not create a stored procedure that drops all stored procedures and functions. I has to be some sql executed from C#.
I tried to drop the stored procedure before creating it, but I get this message:
System.Data.SqlClient.SqlException: 'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Script for one SP for example:
DROP PROCEDURE [dbo].[sp_Economatic_LoadJournalEntryFeedbackByData]
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE PROCEDURE [dbo].[sp_Economatic_LoadJournalEntryFeedbackByData]
@Data VARCHAR(MAX)
AS
BEGIN
...
END
So I guess before creating all SP's and functions I'll need to drop all SP's and functions first with one sql script.