118 lines
3.9 KiB
Transact-SQL
118 lines
3.9 KiB
Transact-SQL
CREATE PROCEDURE [dbo].[Local_CreatePvpDeathTable]
|
|
@createtime datetime
|
|
as
|
|
set nocount on
|
|
|
|
declare @year varchar(50)
|
|
declare @month varchar(50)
|
|
|
|
set @year = convert(varchar, datepart(yy,@createtime))
|
|
set @month = convert(varchar, datepart(mm,@createtime))
|
|
|
|
if OBJECT_ID( 'Pvp_Death_Log_'+ @year+'_'+@month ) IS NULL
|
|
begin
|
|
declare @br varchar(1500)
|
|
set @br='CREATE TABLE Pvp_Death_Log_'+ @year+'_'+@month+
|
|
'(
|
|
[log_id] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[log_type] [smallint] NOT NULL,
|
|
|
|
[room_id] [uniqueidentifier] NOT NULL,
|
|
|
|
[character_id] [uniqueidentifier] NOT NULL,
|
|
[character_name] [nvarchar] (16) NOT NULL,
|
|
[character_class] [int] NOT NULL,
|
|
[character_job] [tinyint] NOT NULL,
|
|
[character_level] [int] NOT NULL,
|
|
|
|
|
|
[kill_id] [uniqueidentifier] NOT NULL,
|
|
[kill_name] [nvarchar] (16) NOT NULL,
|
|
[kill_class] [int] NOT NULL,
|
|
[kill_job] [tinyint] NOT NULL,
|
|
[kill_level] [int] NOT NULL,
|
|
|
|
[date] [datetime] NOT NULL CONSTRAINT [DF_Pvp_Death_Log_'+ @year+'_'+ @month+'_entry_date] DEFAULT (getdate()),
|
|
)'
|
|
exec(@br)
|
|
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_log_type_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[log_type] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_room_id_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[room_id] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_character_id_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_id] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_character_name_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_name] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_character_class_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_class] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_character_job_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_job] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_log_character_level_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_level] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_kill_id_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[kill_id] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_kill_name_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[kill_name] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_kill_class_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[kill_class] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_kill_job_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[kill_job] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_kill_level_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[kill_level] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_date_Pvp_Death_Log_'+ @year+'_'+ @month+'] ON [dbo].[Pvp_Death_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[date] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
|
|
|
|
end
|