Tuesday, June 12, 2012

Schema Binding in SQL Server Views with indexes

There are ways to optimize your views i.e. by adding indexes on your views. In order to achieve this tunning you shoudl first create view with Schema binding.
This is very Simple see SQL below.

CREATE VIEW [dbo].[vw_sampleView] WITH SCHEMABINDING AS
Select * from tbl_Sample

i.e. You just need to add bold text while creating your views. This will allow you to define index on your views which will result as tunned queries to your databases.

No comments:

Post a Comment