
/* drop existing PK constraint, indexes */

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[DT411]') AND name = N'PID411DT411')
ALTER TABLE [dbo].[DT411] DROP CONSTRAINT [PID411DT411]

GO

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[DT411]') AND name = N'SID410DT411')
DROP INDEX [SID410DT411] ON [dbo].[DT411] WITH ( ONLINE = OFF )

GO

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[DT411]') AND name = N'SID412DT411')
DROP INDEX [SID412DT411] ON [dbo].[DT411] WITH ( ONLINE = OFF )

GO

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[DT411]') AND name = N'SID424DT411')
DROP INDEX [SID424DT411] ON [dbo].[DT411] WITH ( ONLINE = OFF )

GO

/* create clustered index first, PK constraint second, non-clustered indexes last */

ALTER TABLE [dbo].[DT411] ADD  CONSTRAINT [PK_DT411_DA+DF] PRIMARY KEY CLUSTERED 
(
	[DI000306] ASC,
	[DI000307] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

GO

CREATE NONCLUSTERED INDEX [DT410_DA] ON [dbo].[DT411] 
(
	[DI000306] ASC
)
INCLUDE ( [DI000213],
[DI000307]) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

GO

CREATE NONCLUSTERED INDEX [DT412_DI] ON [dbo].[DT411] 
(
	[DI000213] ASC
)
INCLUDE ( [DI000306],
[DI000307]) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

GO

/* created by database engine tuning advisor */

CREATE NONCLUSTERED INDEX [_dta_index_DT411_9_214291823__K2_1_3_4_15_16_17_18_19_20_21_23_24_25_26_27_28_29_30_31_32_33_35_36_37_38_39_41_42_43_44_45_46_] ON [dbo].[DT411] 
(
	[DI000306] ASC
)
INCLUDE ( [DI000213],
[DI000307],
[DI001992],
[DI001995],
[DI000106],
[DI001994],
[DI000220],
[DI000221],
[DI000288],
[DI001706],
[DI000223],
[DI001993],
[DI000229],
[DI000230],
[DI000231],
[DI000232],
[DI000233],
[DI000234],
[DI001714],
[DI001718],
[DI000258],
[DI001559],
[DI010198],
[DI010199],
[DI010197],
[DI010200],
[DI022738],
[DI022736],
[DI002364],
[DI002926],
[DI000111],
[DI000203],
[DI003388],
[DI003701],
[DI003703],
[DI009468],
[DI023657],
[DI024111],
[DI026599],
[DI034647],
[DI034648],
[DI026607],
[DI026689],
[DI026691],
[DI027098],
[DI027099],
[DI027465],
[DI027481],
[DI027601],
[DI027685],
[DI029731],
[DI040118],
[DI040119],
[DI040815],
[DI040816],
[DI040869],
[DI040904],
[DI040917],
[DI040921],
[DI040923],
[DI040924],
[DI040968],
[DI041036],
[DI051832],
[DI056857],
[DI056858],
[DI056920],
[DI040918]) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]

GO

/* Boost performance (WI 13952) */

CREATE INDEX "DT411_LB_MOD_ID" ON "DT411" ("DI000111" ASC)
GO

CREATE INDEX "DT411_ACTION_ID" ON "DT411" ("DI027481" ASC)
GO
