TSQL delete proc if it already exists


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.