Solved

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

Posted on 2011-03-15
4
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

617 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