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.
sp_helptext displays the definition that is used to create an object in multiple rows. Each row contains 255 characters of the Transact-SQL definition. The definition resides in the definition column in the sys.
To configure change tracking, you can use DDL statements or SQL Server Management Studio. For more information, see Enable and Disable Change Tracking (SQL Server). To track changes, change tracking must first be enabled for the database and then enabled for the tables that you want to track within that database.
This construction is not allowed in SQL Server. An inline table-valued function can perform as a parameterized view, but is still not allowed to call an SP like this.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With