103 lines
3.4 KiB
Transact-SQL
103 lines
3.4 KiB
Transact-SQL
CREATE PROCEDURE [dbo].[Local_CreateItemTable]
|
|
@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( 'Item_Log_'+ @year+'_'+@month ) IS NULL
|
|
begin
|
|
declare @br varchar(1500)
|
|
set @br='CREATE TABLE Item_Log_'+ @year+'_'+@month+
|
|
'(
|
|
[log_id] [int] IDENTITY(1,1) NOT NULL,
|
|
[date] [datetime] NOT NULL CONSTRAINT [DF_Item_Log_'+ @year+'_'+ @month+'_entry_date] DEFAULT (getdate()),
|
|
[log_type] [int] NOT NULL,
|
|
[world_id] [int] NOT NULL,
|
|
[auth_id] [uniqueidentifier] NOT NULL,
|
|
[bcust_id] [nvarchar](24) COLLATE Korean_Wansung_CI_AS NOT NULL,
|
|
[character_id] [uniqueidentifier] NOT NULL,
|
|
[character_name] [nvarchar](16) COLLATE Korean_Wansung_CI_AS NOT NULL,
|
|
[item_guid] [uniqueidentifier] NOT NULL,
|
|
[item_id] [int] NOT NULL,
|
|
[item_header] [int] NOT NULL,
|
|
[enchant_level] [tinyint] NOT NULL,
|
|
[item_active] [int] NOT NULL,
|
|
[socket_count] [tinyint] NOT NULL,
|
|
[remain_recon] [tinyint] NOT NULL,
|
|
[item_option1] [int] NOT NULL,
|
|
[item_option2] [int] NOT NULL,
|
|
[item_option3] [int] NOT NULL,
|
|
[item_count] [int] NOT NULL,
|
|
[target_itemid] [int] NOT NULL,
|
|
[before_money] [int] NOT NULL,
|
|
[after_money] [int] NOT NULL,
|
|
[change_money] [int] NOT NULL,
|
|
[result] [int] NOT NULL,
|
|
[item_option_value1] [int] NOT NULL,
|
|
[item_option_value2] [int] NOT NULL,
|
|
[item_option_value3] [int] NOT NULL,
|
|
)'
|
|
exec(@br)
|
|
-----
|
|
set @br='ALTER TABLE [dbo].[Item_Log_'+ @year+'_'+ @month+'] WITH NOCHECK ADD
|
|
CONSTRAINT [PK_log_id_Item_Log_'+ @year+'_'+ @month+'] PRIMARY KEY CLUSTERED
|
|
(
|
|
[log_id] ASC
|
|
) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_date_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[date] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_character_name_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_name] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
/* -----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_world_id_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[world_id] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_logtype_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[log_type] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_bcust_id_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[bcust_id] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_character_id_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_id] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_character_name_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[character_name] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
-----
|
|
set @br='CREATE NONCLUSTERED INDEX [IX_item_guid_Item_Log_'+ @year+'_'+ @month+'] ON [dbo].[Item_Log_'+ @year+'_'+ @month+']
|
|
(
|
|
[item_guid] ASC
|
|
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]'
|
|
exec(@br)
|
|
*/
|
|
end
|