Sql Server - Get view creation statement for existing view

前端 未结 6 820
灰色年华
灰色年华 2021-02-06 03:48

Is there a way to get the statement that created a view for an existing view in SQL Server 2008? I thought there was a stored procedure or some metadata that had this data, but

6条回答
  •  执笔经年
    2021-02-06 04:48

    You can see the script as code, and copy paste it into an editor like this:

    SELECT 
        v.TABLE_NAME, 
        v.VIEW_DEFINITION 
    FROM 
        INFORMATION_SCHEMA.VIEWS v 
    WHERE 
        v.TABLE_NAME LIKE '%%'
    

    and insert the view name you want.

提交回复
热议问题