Results 1 to 4 of 4
  1. #1
    adnancanada is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    122

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

    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 by adnancanada; 01-02-2016 at 01:29 AM.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I don't see any syntax errors. Do you have any red squiggles? I would expect a different message if a view name or something already existed.

  3. #3
    adnancanada is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    122
    Quote Originally Posted by ItsMe View Post
    I don't see any syntax errors. Do you have any red squiggles? I would expect a different message if a view name or something already existed.
    Thanks , I am using virtual tables dbo.order is already view. I don't see any red squiggles.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Hmm, I am not an expert with DDL statements. I tried to reproduce the error by trying to index a column on a view of another view. Instead, I got a more descriptive error.

    Perhaps you can get help over in this other forum. I have found it a useful resource.
    https://social.msdn.microsoft.com/Fo...databasedesign

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 04-05-2014, 08:52 PM
  2. Replies: 2
    Last Post: 06-13-2013, 09:10 AM
  3. Replies: 2
    Last Post: 01-28-2013, 08:59 PM
  4. Replies: 3
    Last Post: 12-02-2012, 12:59 AM
  5. Create an index in existing database
    By blip in forum Programming
    Replies: 1
    Last Post: 05-21-2010, 11:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums