Solved

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

Posted on 2011-03-15
4
263 Views
Last Modified: 2012-06-21
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.
0
Comment
Question by:John86a
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 35143507
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.
0
 

Author Comment

by:John86a
ID: 35143887
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..
0
 
LVL 19

Accepted Solution

by:
Bhavesh Shah earned 500 total points
ID: 35144365
Hi,

Please check out below links for removing comments.


For /* */ Comment

http://techcreeze.blogspot.com/2008/11/remove-comments-from-sql-server-stored.html

For -- Comment

http://www.sqlservercentral.com/scripts/un+comment/66353/

VB Code to remove Comment

http://www.freevbcode.com/ShowCode.asp?ID=3166



- Bhavesh
0
 

Author Closing Comment

by:John86a
ID: 35159249
Exactly what I was looking for, thanks.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now