1

When I run

SELECT OBJECT_DEFINITION(m."object_id")
FROM sys.sql_modules m

and output results to text, the definition is truncated for long definitions > 8192 characters. I have maximum characters displayed maxed out at 8192.This function is nearly useless if it cannot output a definition that runs past a small arbitrary limit of 8192 characters, so Microsoft probably thought of a workaround.

What is the (T-SQL, not GUI) workaround to show the entire object definition?

T. Webster
  • 9,605
  • 6
  • 67
  • 94
  • Not sure what you mean by "T-SQL, not GUI". The issue is entirely with the GUI. TSQL has nothing to do with it. The language doesn't have extensions specifically to work around design decisions of SSMS. – Martin Smith Jul 02 '13 at 20:36
  • Martin is correct, the 8192 limit is imposed by your current client (SSMS) and not by anything controllable by T-SQL. The cheap and easy solution is to use a client that doesn't have this limitation. – dpw Jul 02 '13 at 20:47
  • Not sure if this helps you, but you could use [sp_helptext](http://msdn.microsoft.com/en-us/library/ms176112.aspx) – Lamak Jul 02 '13 at 21:00
  • @MartinSmith I see your point in a sense. So if I run the same query through a ADO.NET T-SQL command will I get truncated output or not? Your [answer](http://stackoverflow.com/a/8930141/266457) works for this, btw. – T. Webster Jul 02 '13 at 21:02
  • @T.Webster - If you run the query through ADO.NET it won't be truncated. It is SSMS that truncates it. – Martin Smith Jul 03 '13 at 07:13

1 Answers1

0

If you are using SSMS for the above query, then do check the check below setting (Tools -> Options) in the SSMS where the number of charecters returned from the query to grid is controlled.

Result to grid setting

Surendra
  • 711
  • 5
  • 15