MS SQL Server Concepts and Programming Question:
Download Questions PDF

How To Modify the Underlying Query of an Existing View?

Answer:

If you have an existing view, and want to change the underlying SELECT statement, you can use the "ALTER VIEW ..." statement to redefine the view. The tutorial exercise below shows you how modify an existing view:

USE GlobalGuideLineDatabase;
GO
<pre>
ALTER VIEW ggl_links_top AS
SELECT TOP 3 id, counts, url FROM ggl_links
WHERE counts > 100
ORDER BY counts DESC;
GO
SELECT * FROM ggl_links_top;
GO
id counts url
------ ------- -------------------------------------------
36470 999966 dgqnvmy pyjqd toqcoupuxortasdtzvcae jonfb
12292 999953 qebma wskxqns jnb
6192 999943 p o qisv</pre>


Download MS SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
Can You Use ORDER BY When Defining a View?Can We Insert Data into a View?