How can I display the content of all Views in a db in SQL Server 2008? Is there any new system views to do the same?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The simplest way using Management Studio is to:
This will open a window with the View definition of everything you selected.
EDIT: If you want to query for all your view definitions can you do something like:
If you change your output to Text instead of Grid, it will given you a listing of all your views.
As gbn pointed out, if it’s the schema you want and if some developer is crazy enough to make a view with more than 4k characters, the INFORMATION_SCHEMA views will return null for that view’s schema. So, in that case using the system tables would be more appropriate. A variation of gbn’s solution which is akin to what SMS does behind the scenes would be: