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 function if it already exists


 / Published in: SQL
 

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

Report this snippet  

You need to login to post a comment.