Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, 25 May 2018

How to view the sql for views in sql server - Solved


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.



Click imagination hunt to read latest blogs.


Keep learning and sharing...

No comments:

Post a comment

Featured post

Think that makes you rich and richer

 Napolean said: “You can think and grow rich, but if you can be brought up like most people with work and you won't starve, this wil...