SQL Server 2000 作业调用过程并失败:必须声明变量 @intVariableName
所有,
我设置了一个每晚运行的作业,并且每隔几个月在数据库上执行存储过程时它就会失败。然后第二天晚上就正常了。始终是相同的错误消息:
“必须声明变量 '@intAccountIdent'。[SQLSTATE 01000](消息 18014)。”
我可以向您保证这个变量与许多其他变量一起在我的过程的顶部声明。
这项工作已经存在多年了,直到最近才开始出现此错误。我已经对它进行了分析,将其拆开,验证了 SVN 中的版本与服务器上的版本相同......没有任何变化,但是,这种情况不断发生。我在网上查了一下,但找不到任何可以给我提供任何帮助的东西。
有人遇到过类似的情况吗?老实说,我不知道我是否正在寻找解决方案,或者更多的是解释这样的错误如何能够神奇地自行解决并消失?
任何见解都将不胜感激!
谢谢。
All,
I have a job set up that runs nightly, and, every couple months it will fail when executing a stored procedure on the database. Then, the next night, it runs fine. It's always the same error message:
"Must declare the variable '@intAccountIdent'. [SQLSTATE 01000] (Message 18014)."
I can ensure you that this variable is declared at the top of my procedure, along with many others.
This job has been around for years now, and only recently has it started popping up with this error. I have profiled it, tore it apart, verified that the version in SVN is the same as what's on the server... nothing has changed, yet, this keeps occurring. I've dug around on the web and haven't been able to find anything that could give me any sort of help on this.
Has anyone run into a similar situation? To be honest, I don't know if I'm looking for a solution or more so an explanation of how an error like this can just magically resolve itself and go away?
Any insight is greatly appreciated!
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会尝试在错误发生时运行 SQL Profiler,跟踪事件 SP:StmtStarted、SP:StmtCompleted 和异常(也可能跟踪应用程序向数据库提交的查询的事件)。这可能会显示程序运行时发生的奇怪情况。
这可能还会产生数万行数据进行筛选,因此将其过滤到尽可能少的行非常重要。 (过滤 ObjectName = 您的过程名称是一个开始。)
您能否让它可靠地失败,或者它本质上是随机的?比较好的运行与坏的运行也可能很有用。
I'd try to have SQL Profiler running when the error happens, tracking events SP:StmtStarted, SP:StmtCompleted, and Exceptions (and possibly also those events that track queries being submitted by the application to the database). This may show oddness going on when the procedure runs.
This will probably also produce tens of thousands of rows of data to sift through, so filtering it down to as few rows as possible will be important. (Filtering on ObjectName = your procedure name is a start.)
Can you get it to reliably fail, or is it essentially random? Comparing good runs vs. bad runs may also be useful.