最近我更换了一个SQL Server(2008R2)。 我已经重新安装了托pipe的应用程序并恢复了数据库的备份。 所有似乎都按预期工作,除了这些事件显示在事件日志中:
id 18054 in MSSQLSERVER Error 150010, severity 16, state 96 was raised, but no message with that error number was found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage
我可以从旧服务器使用select * from sys.messages where message_id='150010'
现在我想知道如何在新服务器上复制id> 50000的所有msg信息? 我必须恢复主数据库的备份吗?
既然你仍然可以访问旧的服务器,像这样运行,保存输出到一个文件,并运行到新的服务器。 你可能不得不调整你的消息的varchar长度或引号,但这是我用于最近的迁移。
select 'exec sp_addmessage ' + convert(varchar(6), message_id) + ', ' + convert(varchar(6), severity) + ', ''' + text + '''' from sys.messages where message_id > 50000