---
title: "Views in SQL Server"  
description: "In this blog, I’m trying to explain the views in sql server and how to create it.  A view can be thought of as either a virtual table or a stored quer"  
author: "Sumit Kesarwani"  
published: 2013-05-29  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/521/views-in-sql-server  
category: "database"  
tags: ["database"]  
reading_time: 2 minutes  

---

# Views in SQL Server

In this blog, I’m trying to [explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) the views in [sql server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) and how to create it.\

A view can be [thought of as](https://answers.mindstick.com/qa/39521/who-thought-of-as-a-pioneer-of-economic-nationalism) either a [virtual table](https://www.mindstick.com/interview/876/which-virtual-table-does-a-trigger-use) or a [stored](https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table) query. It enables you to [partition](https://yourviews.mindstick.com/view/87414/who-was-responsible-for-the-1947-partition-and-massacre-gandi-nehru-or-jinnah) the information horizontally or vertically from one or more tables. With a view, the users can see only the [selected fields](https://www.mindstick.com/forum/34099/how-to-customize-selected-fields-in-a-list-in-sencha-touch-app) or selected rows.

A view can only be created in the current database. When a view is created, the name of the view is stored in the sysobjects table and the text of the CREATE VIEW statement is stored in syscomments table.

##### Creating Views

A view can be created using CREATE VIEW statement.

##### Syntax:

```
CREATE VIEW View_NameASSELECT_statements
```

##### Example

```
CREATE VIEW vwEMPASSELECT EMPFIRSTNAME,EMPLASTNAMEFROM EMP
```

##### Output

```
SELECT * FROM vwEMP
```

\
![Views in SQL Server](https://www.mindstick.com/blogs/9a9453db-0790-4213-a884-33f9f4fabb4d/images/0d410678-80c7-41ef-8106-48bbaef31ced.jpg)

##### Alter Views

Alter view statement is used to change the definition of the view.

#### Example

```
ALTER VIEW vwEMPASSELECT EMPFIRSTNAME,EMPLASTNAME,SALARYFROM EMP
```

##### Output

```
SELECT * FROM vwEMP
```

\
![Views in SQL Server](https://www.mindstick.com/blogs/9a9453db-0790-4213-a884-33f9f4fabb4d/images/619f601e-a7df-472d-bc85-bbc1c9ef4d02.jpg)

##### Dropping Views

A view can be dropped using the DROP VIEW statement.

##### Syntax:

DROP VIEW View_Name

##### Example

DROP VIEW vwEMP

---

Original Source: https://www.mindstick.com/blog/521/views-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
