SQL Server启动时向指定表里面添加数据,有时成功有时失败(知道咱们SQL 板块大神多)
有这样这样一个存储过程 sp_startupForMediause mastergoIF exists(select 1 from sysobjects where [name] = 'sp_startupForMedia') drop proc sp_startupForMediaGOcreate procedure sp_startupForMediaas --这里是清除表中数据 delete from karaok..MediasSequence delete from karaok..MediasSequence2 delete from karaok..MediasSequence3 delete from karaok..MediasSequence4 delete from karaok..MediasSequence5 delete from karaok..MediasSequence6 delete from karaok..MediasSequence7 delete from karaok..MediasSequence8 --这里是向 karaok..MediasSequence 表中添加数据 execute karaok..sp_dbmaintaintimer null, null, null, null, 1, 200 execute karaok..sp_dbmaintaintimer null, null, 2, null, 1, 200 execute karaok..sp_dbmaintaintimer null, null, 3, null, 1, 200 execute karaok..sp_dbmaintaintimer null, null, 4, null, 1, 200 execute karaok..sp_dbmaintaintimer null, null, 5, null, 1, 200 execute karaok..sp_dbmaintaintimer null, null, 6, null, 1, 200 execute karaok..sp_dbmaintaintimer null, null, 7, null, 1, 200 execute karaok..sp_dbmaintaintimer null, null, 8, null, 1, 200 --sp_dbmaintaintimer 代码就不贴了,主要是求个为什么会出现这个问题 GOexec sp_procoption 'sp_startup', 'startup', 'true'GO