Searching and Editing Stored Procedure

  • Is there any easy way to :

    Search Stored Procedures for a string (I can do this ok)

    If say 10 are returned, just click on each one and  go into Modify Mode and Alter the stored procedure,  (without having to go back into SSMS and right click and Modify)

    I find myself doing this all the time, and now I search for the Stored Procedures, take a note of the name, and then have to go in, one by one, and modify each one.

     

  • xxx-593414 wrote:

    Is there any easy way to :

    Search Stored Procedures for a string (I can do this ok)

    If say 10 are returned, just click on each one and  go into Modify Mode and Alter the stored procedure,  (without having to go back into SSMS and right click and Modify)

    I find myself doing this all the time, and now I search for the Stored Procedures, take a note of the name, and then have to go in, one by one, and modify each one.

    Assuming your databases are source controlled, this is a fairly simple exercise.

    1. Create a branch in your VCS
    2. Use search / replace on the source .SQL files
    3. Review the file differences
    4. Check in your branch and merge as necessary
    5. Deploy the changes for testing
    6. ...

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Hi Thanks for your reply

    No. SqlServer is not under Source Control

     

  • xxx-593414 wrote:

    Hi Thanks for your reply

    No. SqlServer is not under Source Control

    It should be.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Phil Parkin wrote:

    xxx-593414 wrote:

    Hi Thanks for your reply

    No. SqlServer is not under Source Control

    It should be.

    This. So very much, this.

    Redgate has a free tool that can assist you searching inside your database or across databases. SQLSearch. However, editing, validation, all the rest, you really ought to have the code in source control and then use automated means from there.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • HI Grant. Thanks for that

    I already have a search which lists out the Stored Procedures I am looking for, but what I cannot do is just click on one and then go into Alter for that Stored Procedure

    Regarding the Redgate Search Tool.....say it returns 10 Stored Procedures, what I want to know is:

    Can I then click on any one of these , and go into Alter the Stored Procedure, and when finished, go into another Alter for one of the other 10 Stored Procedures, without having to run the search again

     

  • Yeah. You could. The search results will stay in one window and you can open the queries in another. However, this is the slow, tedious, error prone way to get the job done. Better to use your SQL as code, because it is code. That means getting it into source control.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Hi Grant

    Ok, take your point about Source Control and will look into it

    Re Redgate Search Tool, just to confirm.

    When the Search Tool returns say 10 Stored Procedure names, if you Double Click on any one of them, it goes immediately and directly  into Alter mode fro that Stored Procedure, leaving the others also in a list, so you can then go back to any one of them and Double Click to go into another Stored Procedure

     

     

  • SQL Search provides a list of the procedures that match your string - you then have the ability to select the procedure in the list, click on a link that takes you to the procedure in Object Explorer where you can then right-click and modify.  It does not allow directly opening the procedure.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 9 posts - 1 through 8 (of 8 total)

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