SQL Server: How to edit a view without scripting it?

12,948

Maybe you could give us a hint as to what the aforementioned "easy-to-use tools from Microsoft" were?

There is a View Designer in SSMS as an option. In Object Explorer, right-click a view, click Design or right-click the Views node and click New View..., but it is a bit limited. If your views are at all complex (ie- much beyond simple JOINs) you're pretty much going to be scripting it.

Share:
12,948

Related videos on Youtube

Mark
Author by

Mark

జ్ఞా

Updated on September 18, 2022

Comments

  • Mark
    Mark over 1 year

    How can i edit the definition of a view without having to "script" it in SSMS?

    The previous easy-to-use tools from Microsoft let me:

    1. Enter
    2. wait a moment
    3. Make change
    4. Carefully move mouse to large OK button
    5. Click OK
    6. Down Arrow
    7. goto 1

    With SSMS i've having a much more tedious time of it:

    1. Carefully move mouse to small view to script
    2. Right-click
    3. wait a moment
    4. Carefully move mouse to small menu option Script View as
    5. Carefully move mouse to small menu option ALTER TO
    6. Carefully move mouse to small menu option New Query Editor Window
    7. wait a moment
    8. Press F5
    9. Carefully move mouse to tiny x icon
    10. Click close button
    11. Carefully move mouse to large No button
    12. Click No
    13. goto 1

    i'm really not interested in scripting my view to a new query editor window. i want to edit the view definition. Microsoft seemed to implement editing the definition of a view by resorting to an ALTER VIEW in a new query window.

    Is there a way to view/edit the definition of (a lot) of views, without having to resort to the UI tedium introduced with SQL Server Management Studio?

    • Seth Spearman
      Seth Spearman over 12 years
      I'm curious what "easy-to-use" tools you are talking about?
    • Mark
      Mark over 12 years
      @Joel Coel: If i don't close the tabs then after 5 or 6 dozen SSMS really begins to get sluggish.
    • Mark
      Mark over 12 years
    • squillman
      squillman over 12 years
      What @Joel is trying to say is, instead of opening a new window every time you make your changes in the same window and hit F5. You don't need to reopen the view every time you want to make a change to it.
    • squillman
      squillman over 12 years
      @Ian Ah, that makes more sense now!
  • Mark
    Mark over 12 years
    Designer modifies the formatting, and removes comments, from views.
  • Mark
    Mark over 12 years
    It doesn't matter, or affect the question, or answer. It's a tool that SQL Server 2005 refuses to accept a connection from. And since it's not supported since 2002, and has not been updated for 64-bit Windows, i can no longer run it without Windows XP Mode. Finally, the view designer modifies view definition formatting, and removes comments.
  • Wil
    Wil over 12 years
    He more than likely, by his description, was previously using some kind of designer and made no mention of retaining formatting or comments ;)