Friday, March 30, 2012

How to remove the commented notes in stored procedure?

Hello, everyone:
There are some commented notes in the stored procedure from clients. Is there any way to remove these notes automatically, I mean using scripts etc.
Thanks
ZYTWhat ever for? Are they rude comments? Are they misleading? Are they lies? Do they disparage members of your immediate family?

Comments are there for a purpose. They help future DBAs understand what the procedure is doing. They in no way hinder the performance of the code. Leave them be.|||We want to check some special words in stored procedures. Commented notes will make confusion.|||Then perhaps one solution would be to script your database, write a little MS Word (or other editor) macro to remove the comments, and then do your searching. Maybe not a 100 easy solution, but one that would preserve the comments in the actual DB's stored procedures.

Creating such a macro would be a fairly trivial task in most editors.|||Well, the problem is that you are going to need to identify both single-line comments (with '--' characters) and block comments (bracketed by '/*' and '*/'). Rotsa-Ruck getting it to work reliably, though.|||Problem? What problem? I have a UltraEdit script at home that does the /* */ ('C' programming anyone?) stuff...and would THINK that the -- stuff would be easy also (find "--", delete to EOL).

But as far as reliability...I would be concerned about that...for instance, now that I think about it, my UE macro might not work correctly for /* /* */ */ stuff...

And if it was me, I'd do the searching with the comments staying put. I would think considerably less hassle. You can weed out the comments from the output easier than pulling them from the procs, I would think.sql

No comments:

Post a Comment