Solved

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

Posted on 2011-03-15
4
287 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

809 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