Friday, 18 December 2009

Index On View

Objective: To create index on View

Follow the steps to create index on view. Make sure you always use schemabinding for the view in order to create index.

Create table T_TableName (ID int identity (1,1),ColumnName varchar(50),Telephone Varchar(50))
GO
Create view V_T_TableName with schemabinding
as
Select ID,Columnname,Telephone from dbo.T_TableName(nolock)
GO
Create unique clustered index IX_ID_T_TableName on v_register (id)
GO
Create index IX_Telephone_T_TableName on T_TableName (Telephone) with (online=on)

No comments:

Post a Comment