Link to home
Start Free TrialLog in
Avatar of John86a
John86a

asked on

How to automatically delete all comments on thousands of procedures on a database?

As the title suggests I need to delete about 5-10 lines of comments on each procedure, but there are just TOO MANY of them..
Is there ANY way to automatize this task?

Thanks.
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

You will have to build a T-SQL Script using the OBJECT_DEFINITION() function that retrieves the Stored Procedure text.  Once you have it in a text file you can do whatever you need before re-running.
Avatar of John86a
John86a

ASKER

That way I would need to do it manually (remove the comments), wouldn't I?
I was thinking more along the lines of something automatized, that detects every line that starts with -- and delete it from there..
ASKER CERTIFIED SOLUTION
Avatar of Bhavesh Shah
Bhavesh Shah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John86a

ASKER

Exactly what I was looking for, thanks.