本文介绍了如何解释此 SQL Server 错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 SSMS 执行存储过程,但收到此错误消息:

I am executing a stored proc from SSMS and I get this error message:

Msg 295, Level 16, State 3, Procedure spEdiCreateOrders, Line 80 [Batch Start Line 2]
Conversion failed when converting character string to smalldatetime data type.

当然,我可以尝试犯错,但我希望能够利用该消息,而我对该消息感到有些困惑.
'line 80':从哪里开始?来自 Alter procedureBEGIN 子句?或者它真的指的是我点击 Modify 时看到的第 80 行?
另外,Batch Start Line 2 是什么意思?
谢谢!

Of course I could try and err, but I'd like to be able to take advantage of the message, and I am a bit perplexed by the message.
'line 80': starting from where ? From the BEGIN clause of the Alter procedure ? Or does it really refer to the line 80 I see when I click Modify ?
Also, what does Batch Start Line 2 mean ?
Thx !

edit:请注意,我对帮助解决问题不感兴趣(它已经解决了).我只是想要一个关于如何解释第 80 行"和批量启动第 2 行"的明确指南,以便下次我立即知道该看哪里.

edit: note that I am NOT interested in help solving the issue (it is already solved). I just want a clear guidelines about how to interpret 'line 80' and 'Batch Start Line 2', so that next time I immediately know where to look at.

推荐答案

在使用 Alter procedure 查看存储过程的代码时,错误行来自 BEGIN 命令,因为错误发生在程序中,而不是在Alter procedure 命令中

When looking at the code of a stored procedure using the Alter procedure, the error line is from the BEGIN command, as the error occurred in the procedure, not in the Alter procedure command

  • BEGIN = 第 0 行
  • 下一行(程序的实际开始= 1

批处理行 2 表示第二批语句 - 这意味着您在过程中的某处有一个 GO,这是在第二组语句中 (http://sqlhints.com/tag/examples-of-sql-go-statement/),出现在 GO

Batch line 2 means the second batch of statements - this means you have a GO somewhere in the procedure, and this is in the second set of statements (http://sqlhints.com/tag/examples-of-sql-go-statement/), the first set appearing before the GO

这篇关于如何解释此 SQL Server 错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-10 23:08