Added standard logic at the beginning to check that you are not in a system database

This commit is contained in:
Rich 2011-08-01 20:12:40 +00:00
parent 0da0a6dc56
commit 4d05a2331e

View File

@ -221,8 +221,29 @@ public class GeneratedTemplate : DotNetScriptTemplate
_exportPath = input["outputPath"].ToString();
_dbName = input["chooseDatabase"].ToString();
IDatabase db = MyMeta.Databases[_dbName];
SavePrefix();
SaveProcsSorted(db);
//SaveTables(db);
}
private void SavePrefix()
{
%>IF DB_NAME() IN('MASTER','MODEL','MSDN','TEMPDB')
BEGIN
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 functions to ' + db_name()
GO
<%
}
private bool IncludeVolian(string sName)
{