select text using sp_helptext

Ashif Avatar

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

 

Leave a Reply

Your email address will not be published. Required fields are marked *