Hi developers, you can script views in two ways. I am sharing the query as well as graphical approach, for future reference.
I. By using programmatical(inbuilt stored procedure) approach:
On the standard bar. Open a New Query Window. Write the following query and Click on Execute button.
Syntax:
sp_helptext [ViewName]
Example:
sp_helptext [v_Employee]
Copy and paste the Result to the Query window.
CREATE VIEW v_Employee
AS select *
from [dbo].[Employee]
The highlighted query is the actual query in the view.
II. By graphical approach
Follow the below steps: -
1. In Object Explorer, expand the Views Folder for which you want to view the script.
2. R.Click the View and select Script View as -> Select Create To/Alter To -> New Query Editor Window.
Hope you find the article helpful & interesting.
For any query, comment us below.
Keep learning and sharing...
No comments:
Post a Comment