在SSMS中,编辑存储过程时,如何获取行和错误号匹配? [英] In SSMS, when editing a stored proc, how to get the line and error numbers to match?

查看:161
本文介绍了在SSMS中,编辑存储过程时,如何获取行和错误号匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以上严重措辞的问题(试图简称)。让我们再试一次:



在Microsoft SQL Server Management Studio中,当您编辑SP并在同一窗口中执行sp时,错误会显示在屏幕可以双击突出显示导致错误的代码。然而,这从来没有排成一般,通常是从实际错误的6到13行之间的任何地方,通常较低。它会突出显示诸如评论等等。



任何人都知道如何让这些排队?在T-SQL中什么构成一行?



我已经尝试了所有的正常事情,如在线注释(无效果),删除alter过程行之前的注释没有任何效果),删除所有代码之前的更改程序行,如SET ANSI_NULLS ON等(无效果)。

解决方案

第1行for errors =第一行是sys.sql_modules,可能是ALTER PROCEDURE,但可能是空白行。对于批次是不同的,但问题是存储过程。



VS和SSMS的第1行=窗口中的第一行



所以,以上的SET东西+任何空白行都会导致差异。



解决方案:删除ALTER PROC之上的所有内容,因此这是第1行。 / p>

Terribly worded question above (trying to be short). Lets try that again:

In Microsoft SQL Server Management Studio, when you are editing an SP and execute the sp in the same window, errors show up at the bottom of the screen you can double click to highlight the code causing the error. However, this never lines up, usually being anywhere between 6 to 13 lines from the actual error, usually lower. It will highlight things like comments, etc.

Anyone know how to get these to line up? What constitutes a line in T-SQL?

I have tried all the normal things like putting comments in-line (no effect), removing comments before the alter procedure line (no effect), removing all code before the alter procedure line like SET ANSI_NULLS ON, etc (no effect). Odd.

解决方案

Line 1 for errors = the first line is sys.sql_modules which may be "ALTER PROCEDURE" but could be a blank line. it's different for batches, but the question is about stored procs.

Line 1 for VS and SSMS = 1st line in the window

So, the SET stuff above + any blank lines cause the difference.

Solution: remove everything above "ALTER PROC" so this is line 1.

这篇关于在SSMS中,编辑存储过程时,如何获取行和错误号匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆