Home All Groups Group Topic Archive Search About
Author
20 Nov 2005 9:07 AM
ad
I want to create a Stored Procedure with program.
If the Stored Procedure exist, I want to alter it.
How can I do that?

Author
20 Nov 2005 9:41 AM
luxspes
ad wrote:
> I want to create a Stored Procedure with program.
> If the Stored Procedure exist, I want to alter it.
> How can I do that?
>
>
To delete an stored procedur (only if exists):

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[PROCEDURENAME]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[PROCEDURENAME]

To alter it:
ALTER PROCEDURE PROCEDURENAME.... (and then the new body for the procedure)

hope it helps...

AddThis Social Bookmark Button