How to get a view table query (code) in SQL Server 2008 Management Studio

后端 未结 5 1082
不知归路
不知归路 2020-12-23 17:37

I have a view in SQL Server 2008 and would like to view it in Management Studio.

Example:

--is the underlying query for the view Example_1
select * 
         


        
5条回答
  •  死守一世寂寞
    2020-12-23 18:37

    Use sp_helptext before the view_name. Example:

    sp_helptext Example_1
    

    Hence you will get the query:

    CREATE VIEW dbo.Example_1
    AS
    SELECT       a, b, c
    FROM         dbo.table_name JOIN blah blah blah
    WHERE        blah blah blah
    

    sp_helptext will give stored procedures.

提交回复
热议问题