Changed the script to make sure that this doesn't run in 'MASTER', 'MODEL', 'MSDN' or 'TEMPDB' databases.

This commit is contained in:
Rich 2011-06-13 13:54:21 +00:00
parent beb7b850cd
commit 3e2dfeb90f

View File

@ -1,8 +1,19 @@
if db_name() in('master','model','msdn','tempdb')
begin
print 'Don''t add these to ' + db_name()
return
DECLARE @ErrorMsg varchar(255)
SET @ErrorMsg = 'Don''t add these procedures and functions to ' + db_name()
PRINT '=========================================================================='
PRINT ''
PRINT @ErrorMsg
PRINT ''
PRINT 'You probably want to be in the VEPROMS database'
PRINT ''
PRINT '=========================================================================='
RAISERROR (@ErrorMsg, 20, -1) with log
RETURN
end
print 'Adding procedures and funtions to ' + db_name()
GO
/****** Object: StoredProcedure [addAnnotation] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addAnnotation]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)