/****** Object: Database epet Script Date: 2007-7-4 14:46:37 ******/
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'epet')
DROP DATABASE [epet]
GO
CREATE DATABASE [epet] ON (NAME = N'epet_Data', FILENAME = N'd:\work\database\MSSQL\data\epet_Data.MDF' , SIZE = 1, FILEGROWTH = 10%) LOG ON (NAME = N'epet_Log', FILENAME = N'd:\work\database\MSSQL\data\epet_Log.LDF' , SIZE = 1, FILEGROWTH = 10%)
COLLATE Chinese_PRC_CI_AS
GO
exec sp_dboption N'epet', N'autoclose', N'false'
GO
exec sp_dboption N'epet', N'bulkcopy', N'false'
GO
exec sp_dboption N'epet', N'trunc. log', N'false'
GO
exec sp_dboption N'epet', N'torn page detection', N'true'
GO
exec sp_dboption N'epet', N'read only', N'false'
GO
exec sp_dboption N'epet', N'dbo use', N'false'
GO
exec sp_dboption N'epet', N'single', N'false'
GO
exec sp_dboption N'epet', N'autoshrink', N'false'
GO
exec sp_dboption N'epet', N'ANSI null default', N'false'
GO
exec sp_dboption N'epet', N'recursive triggers', N'false'
GO
exec sp_dboption N'epet', N'ANSI nulls', N'false'
GO
exec sp_dboption N'epet', N'concat null yields null', N'false'
GO
exec sp_dboption N'epet', N'cursor close on commit', N'false'
GO
exec sp_dboption N'epet', N'default to local cursor', N'false'
GO
exec sp_dboption N'epet', N'quoted identifier', N'false'
GO
exec sp_dboption N'epet', N'ANSI warnings', N'false'
GO
exec sp_dboption N'epet', N'auto create statistics', N'true'
GO
exec sp_dboption N'epet', N'auto update statistics', N'true'
GO
if( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) )
exec sp_dboption N'epet', N'db chaining', N'false'
GO
use [epet]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_PetDiary_PetInfo]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[PetDiary] DROP CONSTRAINT FK_PetDiary_PetInfo
GO
/****** Object: Table [dbo].[PetDiary] Script Date: 2007-7-4 14:46:37 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PetDiary]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[PetDiary]
GO
/****** Object: Table [dbo].[PetInfo] Script Date: 2007-7-4 14:46:37 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PetInfo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[PetInfo]
GO
/****** Object: Table [dbo].[PetDiary] Script Date: 2007-7-4 14:46:38 ******/
CREATE TABLE [dbo].[PetDiary] (
[diary_id] [int] IDENTITY (1, 1) NOT NULL ,
[diary_pet_id] [int] NULL ,
[diary_date] [datetime] NULL ,
[diary_title] [varchar] (300) COLLATE Chinese_PRC_CI_AS NULL ,
[diary_weather] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[diary_context] [varchar] (7000) COLLATE Chinese_PRC_CI_AS NULL ,
[diary_is_public] [bit] NULL ,
[diary_last_modify] [datetime] NULL ,
[diary_author] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[diary_author_email] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[PetInfo] Script Date: 2007-7-4 14:46:40 ******/
CREATE TABLE [dbo].[PetInfo] (
[pet_id] [int] IDENTITY (1, 1) NOT NULL ,
[pet_name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[pet_sex] [varchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
[pet_strength] [int] NULL ,
[pet_cute] [int] NULL ,
[pet_love] [int] NULL ,
[pet_intro] [varchar] (7000) COLLATE Chinese_PRC_CI_AS NULL ,
[pet_owner_name] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[pet_owner_email] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
[pet_password] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[pet_pic] [varchar] (300) COLLATE Chinese_PRC_CI_AS NULL ,
[pet_type] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PetDiary] WITH NOCHECK ADD
PRIMARY KEY CLUSTERED
(
[diary_id]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PetInfo] WITH NOCHECK ADD
CONSTRAIN�