SQL OBJECT_DEFINITION returns stored procedure text for editing

I've been using OBJECT_DEFINITION for a long time now, and it has been outputting text of stored procedures to the results grid in a nice and readable format (just like sp_helptext).

Yesterday, I upgraded my machine to Windows 10, and had to reinstall SQL Server (management studio). Now all of a sudden OBJECT_DEFINITION is outputting the entire store procedure text in one line, completely unreadable. How do I make it continue to return text to the results grid in a readable format like sp_helptext.

Extra Details
I have a stored procedure I wrote called "sp_prepareSP" which uses OBJECT_DEFINITION to retrieve the stored procedure text. It then appends text before and after the returned text. Things like "IF EXISTS(...) DROP PROCEDURE", and other things like at the end "GRANT EXECUTE ON ...".
LVL 8
pzozulkaAsked:
Who is Participating?
 
chaauCommented:
No, it is not a bug. It is a feature.
Check this article out. They now have a setting "Retain CR/LF on copy or save". Try it:
CRLF
0
 
chaauCommented:
It works for me. What version of SSMS you have installed?
0
 
pzozulkaAuthor Commented:
2016. Had 2014 before reinstalled ssms.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
chaauCommented:
Do you use "results to grid" or "results to text"?
0
 
pzozulkaAuthor Commented:
Only results to grid. I need this to work using grid.
0
 
chaauCommented:
I think it still should be fine. What happens when you select it and then paste it to a text editor? The difference between the OBJECT_DEFINITION and sp_helptext is that the former returns a text blob in a single row, and the latter is returns a table with each line in a row:
ssmsI have got ssms2014 - they release new products too fast for me to test them all
0
 
pzozulkaAuthor Commented:
When I paste it into the query window it shows up as a single line.
0
 
chaauCommented:
It must be a bug in ssms2016 then.
0
 
pzozulkaAuthor Commented:
That worked. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.