제목 : [1] 테이블과 저장 프로시저 : ~/Schedule/Documents/Schedule.sql
    
    
        
            
                | 글번호: |  | 244 | 
            
                | 작성자: |  | 레드플러스 | 
            
                | 작성일: |  | 2008/07/01 오후 3:03:00 | 
            
            
                | 조회수: |  | 5911 | 
            
        
     
 
    
	
	
    
	--[1] 스케줄 테이블(공통)
CREATE TABLE dbo.Schedule 
(
    [Num] [Int] IDENTITY (1, 1) NOT NULL Primary Key,    --일련번호
    [SYear] [SmallInt] NOT NULL ,                        --년
    [SMonth] [SmallInt] NOT NULL ,                        --월
    [SDay] [SmallInt] NOT NULL ,                        --일
    [SHour] [SmallInt] NOT NULL ,                        --시
    [Title] [VarChar] (150) NOT NULL ,                    --일정제목
    [Content] [Text] NULL ,                                --일정내용
    [PostDate] [SmallDateTime] NULL                     --등록일
    -- 추가 기능은 필드로...
)
Go
--[4] 일정 입력 저장 프로시저 : AddSchedule
Create Procedure dbo.AddSchedule
    @SYear SmallInt,
    @SMonth SmallInt,
    @SDay SmallInt,
    @SHour SmallInt,
    @Title VarChar(150),
    @Content VarChar(8000)
As
    Insert Into Schedule
    Values
    (
        @SYear, @SMonth, @SDay, @SHour, @Title, @Content, GetDate()
    )
Go
--[5] 일정 출력 저장 프로시저 : GetSchedule
Create Proc dbo.GetSchedule
    @SYear SmallInt,
    @SMonth SmallInt,
    @SDay SmallInt
As
    Select * From Schedule 
    Where SYear = @SYear And SMonth = @SMonth And SDay = @SDay
Go
--[6] 상세 저장 프로시저 : ViewSchedule
Create Proc dbo.ViewSchedule
    @Num Int
As
    Select * From Schedule Where Num = @Num
Go
--[7] 수정 : ModifySchedule
Create Proc dbo.ModifySchedule
    @SYear Int,
    @SMonth Int,
    @SDay Int,
    @SHour Int,
    @Title VarChar(150),
    @Content VarChar(8000),
    @Num Int
As
    Update Schedule
    Set
        SYear = @SYear, SMonth = @SMonth,
        SDay = @SDay, SHour = @SHour,
        Title = @Title, Content = @Content
    Where Num = @Num
Go
--[8] 삭제 : DeleteSchedule
Create Proc dbo.DeleteSchedule
    @Num Int
As
    Delete Schedule Where Num = @Num
Go