Determine table referenced in a view in SQL Server

后端 未结 4 682
终归单人心
终归单人心 2020-12-29 14:08

How can i get to know the tables used in a view in SQL Server? Is there a script or a tool that could let me know the tables used in a view and can also list down the fields

4条回答
  •  一向
    一向 (楼主)
    2020-12-29 14:36

    The simplest way to see the content of (most) objects would be:

    sp_helptext blah
    

    Where you substitute blah with the name of the object. This would yield the actual code which created the object. in this case, for instance it could result in:

    CREATE VIEW blah
    AS
      select blah.column1,blah.column2 from blah_table
    

提交回复
热议问题