作者:济河南岸_797 | 来源:互联网 | 2023-05-19 00:25
执行示例如下---1.DroptheclusterindexALTERTABLES_SYORIRIREKIDROPCONSTRAINTPK_S_SYORIRIREKIgo---
执行示例如下
---1. Drop the cluster index
ALTER TABLE S_SYORIRIREKI DROP CONSTRAINT PK_S_SYORIRIREKI
go
---2. Create a new unclustered index --SYORITSUBAN
ALTER TABLE S_SYORIRIREKI ADD CONSTRAINT PK_S_SYORIRIREKI
PRIMARY KEY NONCLUSTERED (SYORITSUBAN)
---3. Create a new unclustered index (with desc) --SYORISYMDHMS
create nonclustered index INDEX_SYORISYMDHMS on S_SYORIRIREKI (SYORISYMDHMS desc) --45s
go
---4. Create a new unclustered index
create nonclustered index INDEX_KINOKANRIIDUSERID on S_SYORIRIREKI (KINOKANRIID,USERID) --45s
go
GO
DECLARE @THETABLE varchar(100);
SET @THETABLE = 'dbo.S_SYORIRIREKI';
select i.*
from sys.indexes i
where i.object_id = OBJECT_ID('S_SYORIRIREKI')
and i.name is not NULL;