select text using sp_helptext

it is great tools for selecting whole text of stored procedure,table etc .

it is very easy to use for dynamic query without using concatenate .

it is also very useful for selecting large sql and use as dynamic.

DECLARE @Table TABLE(
Val VARCHAR(MAX)
)

INSERT INTO @Table EXEC sp_helptext ‘actInvoice_AuditLog’

DECLARE @Val VARCHAR(MAX)

SELECT @Val = COALESCE(@Val + ‘ ‘ + Val, Val)
FROM @Table

SELECT @Val

 

You Might Also Like

Leave a Reply