Why Does The Create Procedure Statement Fail When I Use It With If Statement Here?
I am trying to DROP a stored procedure if it exists and then CREATE it by doing this way: IF OBJECT_ID('[dbo].[myStoredProc]') IS not NULL DROP PROCEDURE dbo.myStoredProc CRE
Solution 1:
Adding GO after your IF statement shows that this is the end of your first query batch.
Read more here:
http://msdn.microsoft.com/en-us/library/ms188037.aspx
IF OBJECT_ID('[dbo].[myStoredProc]') ISnotNULLDROPPROCEDURE dbo.myStoredProc
GO
This will prevent your error from occurring.
Post a Comment for "Why Does The Create Procedure Statement Fail When I Use It With If Statement Here?"