How do I display the /*comments*/ I have added to my SQL 2005 DB Views?

Posted on 2008-11-05
Last Modified: 2012-05-05
I added comments to my View for documentation purposes and when I saved the View the comments were removed from display.  How can I get them to display?  Is there maybe an option in the properties of SQL Server 2005?
Question by:pgetchell
    LVL 39

    Accepted Solution

    Where are you adding the comments?  As you can see from this example below, comments are persisted in the text of the view.
    create view MYview
    select 1 as 'a'
    sp_helptext myview
    drop view MYview

    Open in new window


    Author Comment

    I typed  my comment above the SQL Select statement just as you demonstrated.  I used SQL Server 2005's "wizard gui" View creator thing to make it.  I simply right clicked the VIEWS folder in the tree view of SQL Management Studio and selected "New View..." and wrote my query in the query window that appears and added comment tags  /**/ and when I saved the VIEW the comments disappeared or were removed.  I did not use the CREATE VIEW syntax.
    LVL 39

    Assisted Solution

    Ok.  I have NEVER used the view wizard.  It makes creation of scripts for source control more difficult.

    If you run the query above in SQL Server Management Studio's Query Tool, it works.

    Author Comment

    OK.  I appreciate your help.
    LVL 39

    Expert Comment

    This question has been sitting open for over 2 months.  I believe I answered your question.  Please close.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
    There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now