Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2008-11-05
6
Medium Priority
?
198 Views
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?
0
Comment
Question by:pgetchell
  • 3
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 200 total points
ID: 22888174
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
as
/*
Comment
*/
select 1 as 'a'
go
sp_helptext myview
go
drop view MYview

Open in new window

0
 

Author Comment

by:pgetchell
ID: 22889263
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.
0
 
LVL 39

Assisted Solution

by:BrandonGalderisi
BrandonGalderisi earned 200 total points
ID: 22889477
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.
0
 

Author Comment

by:pgetchell
ID: 22889505
OK.  I appreciate your help.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 23395500
This question has been sitting open for over 2 months.  I believe I answered your question.  Please close.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Dynamic 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 di…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

571 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