Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Returning data in a different format 8 46
Max Consumption Rate (MCR) 3 33
TSQL DateADD update Question 4 28
Sql Join Problem 2 27
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

910 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

20 Experts available now in Live!

Get 1:1 Help Now