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

 

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>