You can get the full text from the view:
sys.sql_modules
However your selectmight not get the full code, since a nvarchar(maX) is cut of in SSMS.
One option is to use print to print each row from the definition. Here I split the definition on char(13) to get each row and use a cursor (yes i know) to print each row.
DECLARE @createSPstring VARCHAR(MAX)
-- get definition of procedure "test"
SELECT @createSPstring = definition
FROM sys.sql_modules
WHERE object_id = OBJECT_ID('test')
-- Declare cursor - split definition on line break
DECLARE rows CURSOR FOR
SELECT [value] row
FROM STRING_SPLIT(@createSPstring, CHAR(13))
DECLARE @row NVARCHAR(MAX)
OPEN rows
FETCH NEXT FROM rows INTO @row
WHILE @@fetch_status = 0
BEGIN
--Print each row
PRINT REPLACE(@row,'char(10)','')
FETCH NEXT FROM rows INTO @row
END
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…