How to create index on View and how to use in sql query (1 Viewer)

adnanhome

Registered User.
Local time
Today, 10:48
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:

llkhoutx

Registered User.
Local time
Today, 12:48
Joined
Feb 26, 2001
Messages
4,018
What is an index going to do for you? Do you mean a unique index?
 

adnanhome

Registered User.
Local time
Today, 10:48
Joined
Nov 12, 2008
Messages
16
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

Top Bottom