Open View or Procedure for mmodification by using command

  • We have tons of views and procedures. It seems like it takes forever to find so I can open and modify. Scrolling up and down, up and down, up and down

    Is there a command to open view or procedure in Query analyzer?

    For example if I type...."Modify View MyView"...in query analyzer

    MyView opens in query analyzer.

  • Unfortunately, no. Something like that just might be useful but not sure how it would be implemented.

  • I'm with you on this one. I've long wished for a way to group objects in SSMS by name, category, etc. Databases with hundreds or even thousands of objects can cost you a lot of time just finding your object in the browser.

    A quick and dirty way to see your object text is to call sp_helptext, which will return the text of the view/sproc.

    EXEC sp_helptext([object_name])

    hth,

    Tim

    Tim Mitchell, Microsoft Data Platform MVP
    Data Warehouse and ETL Consultant
    TimMitchell.net | @Tim_Mitchell | Tyleris.com
    ETL Best Practices

  • I use sp_helptext and then I copy the text from the results pan to the query pan. One thing that I do at every place that I work is to define a keyboard shortcut for sp_helptext, sp_help, sp_spaceused. This way when I check the code of a stored procedure and it references a view or another piece of code, I can just mark the name of the view/other piece of code and use the keyboard to see that code in the results pane. I can also see a query in the code and mark a table name and then check the table’s size and structure by running through the keyboard sp_spaceused and sp_help.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • computer.mike (5/20/2009)


    For example if I type...."Modify View MyView"...in query analyzer

    MyView opens in query analyzer.

    hi,

    Also try this option,

    create this as your own sp and kept it in shortcut key to execute

    CREATE PROC Sp_Modify_View

    (

    @tabname_tmp VARCHAR(50)

    )

    AS

    BEGIN

    create table #temp (text1 varchar(max))

    insert into #temp

    exec sp_helptext @tabname_tmp

    --select replace(text1,'CREATE procedure','ALTER procedure')from #temp

    select replace(text1,'CREATE VIEW','ALTER View')from #temp

    END

    ARUN SAS

  • Hi,

    You can use Filter option so you dont have to too much scroll up and down.

  • The filter option works, but it's only static for a single session. When you close and reopen SSMS, the filter is gone.

    Tim Mitchell, Microsoft Data Platform MVP
    Data Warehouse and ETL Consultant
    TimMitchell.net | @Tim_Mitchell | Tyleris.com
    ETL Best Practices

Viewing 7 posts - 1 through 6 (of 6 total)

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