
/* drop existing PK constraint, indexes */

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

GO

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

CREATE UNIQUE CLUSTERED INDEX [pr+report+item+task+res+ct_IDs] ON [dbo].[DT827] 
(
	[DI008516] ASC,
	[DI008535] ASC,
	[DI008536] ASC,
	[DI008517] ASC,
	[DI008518] ASC,
	[DI008519] ASC
)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

ALTER TABLE [dbo].[DT827] ADD  CONSTRAINT [PK_DT827] PRIMARY KEY NONCLUSTERED 
(
	[DI008516] ASC,
	[DI008535] ASC,
	[DI008536] 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 UNIQUE NONCLUSTERED INDEX [PK_covering_query] ON [dbo].[DT827] 
(
	[DI008516] ASC,
	[DI008535] ASC,
	[DI008536] ASC
)
INCLUDE ( [DI008517],
[DI008518],
[DI008519]) 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 [FK_DT461] ON [dbo].[DT827] 
(
	[DI008516] ASC
)
INCLUDE ( [DI008535],
[DI008536],
[DI008517],
[DI008518],
[DI008519]) 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 [FK_DT463] ON [dbo].[DT827] 
(
	[DI008516] ASC,
	[DI008517] ASC
)
INCLUDE ( [DI008535],
[DI008536],
[DI008518],
[DI008519]) 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 [FK_DT466] ON [dbo].[DT827] 
(
	[DI008516] ASC,
	[DI008517] ASC,
	[DI008518] ASC
)
INCLUDE ( [DI008535],
[DI008536],
[DI008519]) 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 [FK_DT467] ON [dbo].[DT827] 
(
	[DI008518] ASC
)
INCLUDE ( [DI008516],
[DI008535],
[DI008536],
[DI008517],
[DI008519]) 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 [FK_DT470] ON [dbo].[DT827] 
(
	[DI008519] ASC
)
INCLUDE ( [DI008516],
[DI008535],
[DI008536],
[DI008517],
[DI008518]) 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 [FK_DT826] ON [dbo].[DT827] 
(
	[DI008516] ASC,
	[DI008535] ASC,
	[DI008517] ASC,
	[DI008518] ASC
)
INCLUDE ( [DI008536],
[DI008519]) 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 [COSTS_TOTAL] ON [dbo].[DT827] 
(
	[DI008666] ASC
)
INCLUDE ( [DI008535],
[DI008536],
[DI008516],
[DI008517],
[DI008518],
[DI008519]) 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
