Skip to content
Advertisement

SQL server 2012 SP_HELPTEXT extra lines issue

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

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 ??

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

Thanx in advance.

Advertisement

Answer

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.

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.

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

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.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement