How to create index on View and how to use in sql query

adnanhome

Registered User.
Local time
Today, 04:57
Joined
Nov 12, 2008
Messages
16
I know how to create index on tables but dont know how to create index on view. I have views virtual tables want to create index on it via pass through query.

CREATE VIEW DBO.VWABC
WITH SCHEMABINDING
AS
SELECT NAME, PO, SAL, DEPT, TERM FROM dbo.ORDER
GO
CREATE UNIQUE CLUSTERED INDEX UIX_PO
ON DBO.VWABC(PO)

I am getting this message?

Incorrect syntax error near keyword 'Create', (#156)

Am I missing anything
 
Last edited:
What is an index going to do for you? Do you mean a unique index?
 
What is an index going to do for you? Do you mean a unique index?
I am running a query has millions of records. I have going to index by PO otherwise my query freez
 

Users who are viewing this thread

Back
Top Bottom