well, I had a nice reply for you on SMO but that's out the door.
From my previous reply on Alter() and simply removing comments in the SP all you need to do is .Replace() the blocks and or comment lines (--). Regular Expressions is going to be your most efficient and best method in .NET to get this done.
To give you a simple example of this lets look at everything commented as /* */
Regular Expressions are fairly straight forward. If you make it simple it will be. A easy reference is
here and
here
Although this really doesn't belong in the SQL forum I'll finish the thread but I recommend going to the VB.NET forum after this please. This type of question may have a fine line though.
So from scratch.
Create the server object, database object and stored procedure object
Code:
Dim srv As SQLDMO.SQLServer = New SQLDMO.SQLServer
Dim db As SQLDMO.Database = New SQLDMO.Database
Dim sp As SQLDMO.StoredProcedure = New SQLDMO.StoredProcedure
The next step I'm sure is review for you. Simply get the stored procedure text so you have it in your programs memory to manipulate. In my example I have a database named "test", table named "num" and sp named "usr_test" (I liek the word test

)
Code:
srv.LoginSecure = True
srv.Connect("[servername]")
db = srv.Databases.Item("test")
sp = db.StoredProcedures.Item("usr_test")
Again nothing special. The RegEx part is nothing special either (although sense I used test for everything I kept replacing the sp name

)
To use a .Replace on RegEx you simply use that method in the RegEx as
RegEx.Replace(str,pattern,replace string)
Remember to rbing in the System.Text.RegularExpressions
for a pattern that will find comments such as /* test */ you could go with
Dim pattern As String = "/\*[a-z\s]{0,}\*/"
That pattern equates to
/* any text or spaces */ (note I didn't check for numbers and there are special characters, characters classes you can use. That's your job to look them up from the link
The {0,} says zero or more matches. remember that [a-z] will match only one letter and only lower case. Use A-Z etc. all in the link I posted above.
* is a quantifier in regular expressions thus you need to escape it with \ (same as in java, C# etc... for escaping char's)
Now that we've gotten through that the rest is straight forward.
Code:
Dim orgSP As String = sp.Text.ToString()
Dim alterSP As String = Regex.Replace(orgSP, pattern, "")
sp.Alter(alterSP)
You just altered you stored procedure replacing anything found enclosed in /* */ in lower case.
Congradulations and have fun!
____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done