Posted By

hoffstein on 10/14/08


Tagged

tsql


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hoffstein


TSQL delete proc if it already exists


 / Published in: SQL
 

  1. IF EXISTS (
  2. SELECT 1 FROM INFORMATION_SCHEMA.ROUTINES
  3. WHERE ROUTINE_NAME = 'p_MyProc'
  4. AND ROUTINE_SCHEMA = 'dbo'
  5. AND ROUTINE_TYPE = 'PROCEDURE'
  6. )
  7. BEGIN
  8. DROP PROCEDURE dbo.p_MyProc
  9. PRINT 'Dropped dbo.p_MyProc'
  10. END

Report this snippet  

You need to login to post a comment.