IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'Ranking') DROP DATABASE [Ranking] GO CREATE DATABASE [Ranking] ON (NAME = N'Ranking_Data', FILENAME = N'C:\Ranking_Data.MDF' , SIZE = 12, FILEGROWTH = 10%) LOG ON (NAME = N'Ranking_Log', FILENAME = N'C:\Ranking_Log.LDF' , SIZE = 56, FILEGROWTH = 10%) GO exec sp_dboption N'Ranking', N'autoclose', N'false' GO exec sp_dboption N'Ranking', N'bulkcopy', N'false' GO exec sp_dboption N'Ranking', N'trunc. log', N'false' GO exec sp_dboption N'Ranking', N'torn page detection', N'true' GO exec sp_dboption N'Ranking', N'read only', N'false' GO exec sp_dboption N'Ranking', N'dbo use', N'false' GO exec sp_dboption N'Ranking', N'single', N'false' GO exec sp_dboption N'Ranking', N'autoshrink', N'false' GO exec sp_dboption N'Ranking', N'ANSI null default', N'false' GO exec sp_dboption N'Ranking', N'recursive triggers', N'false' GO exec sp_dboption N'Ranking', N'ANSI nulls', N'false' GO exec sp_dboption N'Ranking', N'concat null yields null', N'false' GO exec sp_dboption N'Ranking', N'cursor close on commit', N'false' GO exec sp_dboption N'Ranking', N'default to local cursor', N'false' GO exec sp_dboption N'Ranking', N'quoted identifier', N'false' GO exec sp_dboption N'Ranking', N'ANSI warnings', N'false' GO exec sp_dboption N'Ranking', N'auto create statistics', N'true' GO exec sp_dboption N'Ranking', N'auto update statistics', N'true' GO if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) ) exec sp_dboption N'Ranking', N'db chaining', N'false' GO use [Ranking] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SP_POINT_ACCUMULATION]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[SP_POINT_ACCUMULATION] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EVENT_INFO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[EVENT_INFO] GO CREATE TABLE [dbo].[EVENT_INFO] ( [Server] [tinyint] NOT NULL , [Square] [tinyint] NOT NULL , [AccountID] [varchar] (10) NOT NULL , [CharacterName] [varchar] (10) NOT NULL , [Class] [tinyint] NOT NULL , [Point] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[EVENT_INFO] WITH NOCHECK ADD CONSTRAINT [PK_EVENT_INFO] PRIMARY KEY CLUSTERED ( [Server] DESC , [Square] DESC , [AccountID] DESC , [CharacterName] DESC ) ON [PRIMARY] GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO --//************************************************************************ --// ³» ¿ë : µ¥ºô À̺¥Æ® Æ÷ÀÎÆ® Á¤º¸ ´©Àû --// ºÎ ¼­ : °ÔÀÓ°³¹ßÆÀ --// ¸¸µéÀÏ : 2003.01. 21 --// ¸¸µéÀÌ : Ãß¼÷ --// --//************************************************************************ CREATE PROCEDURE SP_POINT_ACCUMULATION @Server tinyint, -- ¼­¹ö @Square tinyint, -- ±¤Àå @AccountID varchar(10), @CharacterName varchar(10), @Class tinyint , @Point int As Begin BEGIN TRANSACTION SET NOCOUNT ON IF EXISTS ( SELECT CharacterName FROM EVENT_INFO WITH (READUNCOMMITTED) WHERE Server = @Server AND AccountID = @AccountID AND CharacterName = @CharacterName ) Begin UPDATE EVENT_INFO SET Point = Point + @Point , Square = @Square WHERE Server = @Server AND AccountID = @AccountID AND CharacterName = @CharacterName End ELSE Begin INSERT INTO EVENT_INFO ( Server, Square, AccountID, CharacterName, Class, Point ) VALUES ( @Server, @Square, @AccountID, @CharacterName, @Class, @Point ) End IF(@@Error <> 0 ) ROLLBACK TRANSACTION ELSE COMMIT TRANSACTION SET NOCOUNT OFF End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO