December 7, 2013

How to create Index on view in SQL

Normally you can not create index on view but if You bind schema of base table with view then you can create index on view.

To do that first you need to drop existing view then recreate that view with schema binding option.

DROP VIEW view TestView
CREATE VIEW TestView WITH SCHEMABINDING
AS
SELECT Id,Name,,Address,Phone,Fax,Email FROM dbo.tableName

No comments:

Post a Comment