Pages

Jul 2, 2008

How to check whether the SP exist and DROP the SP

-- Checks the sys objects for the existence of SP and drops it.
IF EXISTS (SELECT 1 FROM sys.objects
WHERE object_id = OBJECT_ID (N'[dbo].[SP_Name]')
AND
type in (N'P', N'PC'))
BEGIN
DROP PROCEDURE [dbo].[SP_Name]

END

No comments: