Script specific stored procedures

  • Dear All,

    I have a database which has about 50000 stored procedures. I need to script out around 200 procedures from the database. Using SSMS i am finding difficult to go and search for the object name one by one and generate the script. Is there a way to script out n number of objects using any query or simple tools. Thanks in advance!

     

  • look for dbatools.io - with it you can script some, but not all of the objects, and can apply filtering.

    and I may be able to post another script that does script all you want filtering for those you need.

     

     

  • Either that or look into sys.SQL_Modules, which is a system object that comes with SQL Server and can be interrogated using  T-SQL.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thank you. Waiting for your scripts eagerly.

  • script attached.

    can easily be changed to filter only the procs you desire on the line

    $storedProcs = $db.StoredProcedures

     

    Attachments:
    You must be logged in to view attached files.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply