创建视图索引:
第一步,创建视图
必须使用WITH SCHEMABINDING, 而且 语句中不能有left join,right join等, 只允许inner join 连接,
且各种分组函数等不能使用, 语句中 不能使用 select * from , 需要将要显示的字段写出来
CREATE VIEW V_AnswerTest WITH SCHEMABINDING
AS
select语句
GO
创建唯一聚集索引
CREATE CLUSTERED INDEX IX_PatientId
ON V_AnswerTest (PatientId)
go
非聚集索引
create NONCLUSTERED INDEX IX_PatientId ON V_AnswerTest (PatientId)
/////以下这一段,在创建索引时或者创建索引执行
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
https://www.cnblogs.com/kaoleba/p/6340230.html