Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Need to retrieve body of stored procedure

$
0
0

Hi there,

Here is a stored procedure :

/************************************************************  
 * SOME COMMENT 
 ************************************************************/  
  
CREATE  PROCEDURE [dbo].[MyStoredProcedure](@Argument1 int , @Argument2 varchar(50) , @Argument3 INT =0)  
AS  
BEGIN  
 SET NOCOUNT ON  
   
PRINT 'HELLO THERE'
-- some other content
END

I would like to retrieve the body of this (that means all the text block between "AS BEGIN" and "END". I'm trying to do this with regexp, but as I'm not an expert (hardly a beginner), I would need some help. I started with something like :

(?:\S+\s)?\S*BEGIN\S*(?:\s\S+)?(.*) but I don't know how to say to the regexp to take also the AS before... And therefore only the text that follows...

The idea of this is to compare a stored procedure from a database with a stored procedure to be deployed. I need to check if they are different or not.

Thanks for your help,

Did


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>