SQL editor RRS feed

  • Question

  • User-1836216065 posted


    Is there a way that I can display SQL stored procedures in ASP.Net and keep all the formatting?  Also, I want to allow the user to be able to edit it and save it back to the database.

    I can get the SP and reapplying it to the database without any issues, but I can't find an object that will allow me to display and edit it easily. 

    Is there a ready built object that allow me to do this?

    Thanks in advance.


    Tuesday, September 2, 2008 5:03 AM

All replies

  • User2098947605 posted

    You can use the Microsoft.SQLServer.SMO namespace to get your store procudures.  The following will script all of the stored procedure in your database. 

    Dim svr As Server = New Server("Name of server here")

    Dim so As ScriptingOptions = New ScriptingOptions()

    so.IncludeHeaders = True

    so.SchemaQualify = True

    Dim sOut As New StringBuilder

    For Each sp As StoredProcedure In svr.Databases("Database Name here").StoredProcedures

    For Each s As String In sp.Script(so)


    Next s


    Next sp

    Tuesday, September 9, 2008 7:04 PM