Hi!
I need to write a t-sql-script like this:
(case-1)
IF {stored procedure SP is not exists} BEGIN
CREATE PROCEDURE SP
AS BEGIN
//dummy body
END
END
ALTER PROCEDURE SP
AS
BEGIN
//real body
END
and dislike the case below because it is possible that CREATE fails
after DROP and we lost any (old or new) SP versions:
(case-2)
IF {stored procedure SP is exists} BEGIN
DROP PROCEDURE SP
END
CREATE PROCEDURE SP
AS
BEGIN
//real body
END
How to write the script lile (1) correctly? Now I have a troubles while
inserting "CREATE PROCUDURE" inside "IF true BEGIN ... END" block.
*** Sent via Developersdex http://www.developersdex.com ***