• Register
Welcome to SQL Server Planet ASK!, where you can ask questions and receive answers from other members of the community.
Return to SQLServerPlanet.com

what is view in sql server 2005

0 votes
asked Jan 24 in Getting started with SQL Server by anonymous
recategorized Jan 24 by derek

1 Answer

0 votes
Hi,

A view is simply a saved select statement.   It does not contain data.  When you call a view, it executes that select statement.

let's use this sample view as an example:

CREATE VIEW vw_customer

AS

BEGIN

SELECT * FROM customer

END

 

If you make a call to the view like this:

SELECT * FROM vw_customer

it's the same as if you are executing the following:

SELECT * FROM (SELECT * FROM CUSTOMER)

Another reason to create a view is to provide a layer of abstraction for the underlying table.  This could be for security reasons, or to alias the columns, or to provide additional columns.

Derek
answered Jan 24 by derek (230 points)