I'm building a script to get all the triggers in the document, but I want to include newlines. I'm copying and pasting this into excel in order to then quickly generate some mandated documentation, but all the contents from the text column end up being generated without newlines.
The line I'm currently using, which produces truncation in results to file is:
SELECT OBJECT_DEFINITION(sys.objects.object_id)
FROM sys.objects
WHERE type = 'TR'
3条答案
按热度按时间b4wnujal1#
No copy paste needed :)
vybvopom2#
For one, don't use syscomments on SQL Server 2005+. Use sys.sql_modules or OBJECT_DEFINITION. The datatype in syscomments in nvarchar(4000) which means truncation.
If you're in:
So, why not use one of these techniques:
egdjgwm83#
in ssms 19 switch on "retain CR/LF on copy or save" option in (tools > options) query results > sql server > results to grid . that should fix it.