SQL server 2012 SP_HELPTEXT 额外行问题

2022-01-20 00:00:00 sql ide formatting sql-server

我使用的是 SQL Server 2012,&总是使用 SP_HELPTEXT 来获取我之前创建的存储过程,在以前版本的 SQL Server 中这个过程没有问题,但是在 2012 年,我的存储过程带有额外的行,例如这是我写了

I am using SQL server 2012, & always use SP_HELPTEXT to get my previously created Stored Procedures, In previous versions of SQL server there were no issues in this process but in 2012, My Stored Procedures come with extra lines, for example this is the procedure that I wrote

Create proc SP_Test
as
begin
 Select * 
 from table_ABC
end

现在将 SP_HELPTEXT 与此过程(或任何其他过程)一起使用后,我得到了此输出

Now after using SP_HELPTEXT with this procedure (or any other procedure), I am getting this output

Create proc SP_Test

as

begin

 Select * 

 from table_ABC

end

是否还有其他人也面临这个问题,或者我是这个星球上唯一一个与这个问题作斗争的人??有没有人知道如何解决这个问题??

Do any one else also facing this problem or I am the only one on this planet to struggle with this issue ?? Does any body know how to solve this issue ??

我的SQL server的配置如下(复制自Help -> About)

Configuration of my SQL server is as follows (copied from Help -> About )

Microsoft SQL Server Management Studio          11.0.2100.60
Microsoft Analysis Services Client Tools        11.0.2100.60
Microsoft Data Access Components (MDAC)         6.1.7601.17514
Microsoft MSXML                     3.0 6.0 
Microsoft Internet Explorer             9.0.8112.16421
Microsoft .NET Framework                4.0.30319.269
Operating System                    6.1.7601

提前感谢.

推荐答案

如果我运行 sp_helptext 并设置 Results to grid,我可以复制此行为,然后复制并粘贴将网格中的结果放入新查询或任何其他文本编辑器中.

I can replicate this behaviour if I run sp_helptext with Results to grid set, then copy and paste the results from grid into a new query or any other text editor.

这似乎是 sp_helptext 与以前版本相比的行为发生了变化,因为标准网格结果集不显示此效果.

This seems to be a change in the behaviour of sp_helptext from previous editions, since this effect isn't displayed with standard grid result sets.

最简单的解决方法是运行 sp_helptext 并设置 Results to text (Query -> Results to > 结果转文本,快捷键CTRL + T.

The simplest work-around will be to run sp_helptext with Results to text set (Query -> Results to > Results to text, shortcut CTRL + T.

您可能需要增加 Results to text 中每行的最大字符数以获得您期望的输出 - Tools > Options> 查询结果 > Results to text - 设置每列显示的最大字符数"为最大值8192.

You may need to increase the maximum number of characters per line in Results to text to get the output you expect - Tools > Options > Query Results > Results to text - set "maximum number of characters displayed in each column" to the maximum value of 8192.

相关文章