Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-15
4
Medium Priority
?
318 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 2000 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 your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

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…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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.

963 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