.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

What do you mean by indexed views?

Posted By: Deco     Posted Date: October 27, 2010    Points:2   Category :Sql Server
What does the indexed view mean... Please give me some sample code

Responses
Author: Sajid P K             
Posted Date: October 27, 2010     Points: 5   

Hi,

An indexed view is a view that has a unique clustered index created on it. Normally views do not exist on disk as rows. That changes for indexed views, which exist in the database as rows that realize the view. There can also be non-clustered indexes on the view so long as it has the unique clustered index.

Since the indexed view exists on disk there are two types of overhead added to the database:

The disk space taken up by the view
The cost of maintaining the view on disk as the base tables are modified.


Eg:


create view "Order Details Extended" AS
SELECT OD.OrderID, OD.ProductID, Products.ProductName,
OD.UnitPrice, OD.Quantity, OD.Discount,
(CONVERT(money,(OD.UnitPrice*Quantity*(1-Discount)/100))*100)
AS ExtendedPrice
FROM Products INNER JOIN "Order Details" OD
ON Products.ProductID = "Order Details".ProductID




More : http://www.databasejournal.com/features/mssql/article.php/2119721/Indexed-Views-Basics-in-SQL-Server-2000.htm



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend