How to retrieve the SQL Comment field from the view properties in the code of a program invb.net.
When a view is created using SSMS and saved then when you try to modify it the properties windows has a field named 'SQL Comment'. Text can be entered into this field and saved. The next time the view is edited the comment field displays the text. I would like to be able to retrieve this field in my VB program. The reason is I am allowing a user to select which view he/she wishes to use. Displaying this comment will allow me to provide the user with some descriptive text about this view.
Doing a bit of testing, I can only find this 'SQL Comment' in the script for the view. So if you right-click and script out the view, whatever you've put as the value of 'SQL Comment' will appear as a block comment (in `/*...*/`) at the top of the view definition. It might not be stored anywhere on it's own - I suspect that when you save the view from the designer, it updates the `definition` value in `sys.sql_modules`, with that comment inline. Some clever string manipulation and you could get it from there I guess?