Hello, SQL2008R2
I am trying to find stored procedures that have 'EXEC' or 'EXECUTE'. Now I would like to exclude the procedures where the only place EXEC exists is commented out. I am using the column [definition] from table sys.sql_modules to look at the code.
I thought about something like
I would like to get the first three records but not the last two. This may not be possible.
Thank you,
djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
I am trying to find stored procedures that have 'EXEC' or 'EXECUTE'. Now I would like to exclude the procedures where the only place EXEC exists is commented out. I am using the column [definition] from table sys.sql_modules to look at the code.
I thought about something like
Code:
declare @temp1 TABLE (testtext varchar(max));
insert into @temp1 VALUES
('This is a test EXEC abc'),
('This is a test EXEC abc -- EXEC'),
('This is a test EXEC abc EXEC cde'),
('This is a test -- EXEC'),
('This is a test EXEC cde');
-- return all five
select * from @temp1;
-- returns only one - but I would like three
select * from @temp1
where 1=1
and testtext like '%EXEC%'
and testtext not like '%-- EXEC%'
and testtext NOT LIKE '%EXEC cde%';
Thank you,
djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!