View index creation

Create the view index:

  The first step is to create a view

  WITH SCHEMABINDING must be used, and there can be no left join, right join, etc. in the statement, only inner join is allowed,
  and various grouping functions cannot be used, and select * from cannot be used in the statement, and the fields to be displayed need to be written out

  CREATE VIEW V_AnswerTest WITH SCHEMABINDING
    AS
    

     select statement

  
    GO

 Create a unique clustered index

CREATE  CLUSTERED  INDEX IX_PatientId
ON V_AnswerTest (PatientId)
go

 

nonclustered index

create NONCLUSTERED INDEX IX_PatientId ON V_AnswerTest (PatientId)

///// The following paragraph is executed when creating an index or creating an index

 Set ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET NUMERIC_ROUNDABORT OFF

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325294771&siteId=291194637