Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I view the SQL statement a View is based on? 2

Status
Not open for further replies.

vbajock

Programmer
Jun 8, 2001
1,921
US
Using SQL Server 2012 Management Studio, I can pull up the view in design view, I can see the graphical representation of the view and under it a listing of columns, is there any way I can see the complete SQL statement that generates the view?
 
You can right click on the view in Management Studio, then "Script View As" -> "Alter To" -> "New Query Editor Window"

Or... in a new query window....

Code:
sp_helpText 'NameOfViewHere'

Press CTRL-T to put the output in to text mode, and then run the query.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top