﻿/****** Object:  Table [dbo].[actItem]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[actItem](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[partno] [nvarchar](100) NULL,
	[subject] [nvarchar](100) NULL,
	[print_init] [nvarchar](100) NULL,
	[kind] [int] NULL,
	[price] [real] NULL,
	[status] [nvarchar](1) NULL,
	[demo] [nvarchar](max) NULL,
	[extend] [nvarchar](1) NULL,
	[cycle] [int] NULL,
	[category] [int] NULL,
	[customize_data] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[is_reconcile] [nvarchar](1) NULL,
 CONSTRAINT [PK_actItem] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[activity]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [int] NULL,
	[subject] [nvarchar](100) NULL,
	[print_init] [nvarchar](100) NULL,
	[address] [nvarchar](200) NULL,
	[startDate_solar] [datetime] NULL,
	[endDate_solar] [datetime] NULL,
	[hall] [nvarchar](50) NULL,
	[start_sexagenary] [nvarchar](2) NULL,
	[end_sexagenary] [nvarchar](2) NULL,
	[monk] [nvarchar](50) NULL,
	[startDate_lunar] [datetime] NULL,
	[endDate_lunar] [datetime] NULL,
	[dueDate] [datetime] NULL,
	[demo] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[customize_data] [nvarchar](max) NULL,
	[category_kind] [int] NULL,
 CONSTRAINT [PK_activity] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[followers]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[followers](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[f_number] [nvarchar](20) NULL,
	[u_name] [nvarchar](20) NULL,
	[sex] [nvarchar](2) NULL,
	[identity_type] [int] NULL,
	[birthday] [datetime] NULL,
	[phone] [nvarchar](max) NULL,
	[email] [nvarchar](200) NULL,
	[refugedate] [datetime] NULL,
	[refuge_name] [nvarchar](20) NULL,
	[address] [nvarchar](200) NULL,
	[demo] [nvarchar](max) NULL,
	[leader] [int] NULL,
	[socialid1] [nvarchar](50) NULL,
	[socialid2] [nvarchar](50) NULL,
	[tab] [nvarchar](max) NULL,
	[contactor] [nvarchar](20) NULL,
	[contactor_phone] [nvarchar](max) NULL,
	[blood] [nvarchar](2) NULL,
	[customize_data] [nvarchar](max) NULL,
	[introducer] [nvarchar](20) NULL,
	[refuge_area] [nvarchar](25) NULL,
	[id_code] [nvarchar](max) NULL,
	[passport] [nvarchar](max) NULL,
	[cellphone] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[admin_log] [nvarchar](50) NULL,
	[join_date] [datetime] NULL,
	[country] [nvarchar](5) NULL,
	[appellation_id] [int] NULL,
	[follower_hash] [nvarchar](100) NULL,
 CONSTRAINT [PK_followers] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[pro_order]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[pro_order](
	[order_no] [nvarchar](20) NOT NULL,
	[up_time] [datetime] NULL,
	[reg_time] [datetime] NULL,
	[keyin1] [nvarchar](3) NULL,
	[f_num] [int] NULL,
	[phone] [nvarchar](max) NULL,
	[activity_num] [int] NULL,
	[address] [nvarchar](200) NULL,
	[demo] [nvarchar](max) NULL,
	[customize_data] [nvarchar](max) NULL,
	[introducer] [int] NULL,
	[send_receipt] [bit] NULL,
	[receipt_title] [nvarchar](max) NULL,
 CONSTRAINT [PK_pro_order] PRIMARY KEY CLUSTERED 
(
	[order_no] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[pro_order_detail]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[pro_order_detail](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[order_no] [nvarchar](20) NOT NULL,
	[actItem_num] [int] NULL,
	[parent_num] [int] NULL,
	[print_id] [nvarchar](100) NULL,
	[f_num] [int] NULL,
	[f_num_tablet] [nvarchar](max) NULL,
	[address] [nvarchar](200) NULL,
	[from_id] [int] NULL,
	[from_id_tablet] [nvarchar](max) NULL,
	[due_date] [datetime] NULL,
	[bed_type] [int] NULL,
	[price] [real] NULL,
	[qty] [int] NULL,
	[start_date] [datetime] NULL,
	[extend_date] [datetime] NULL,
	[pay] [real] NULL,
	[pay_date] [datetime] NULL,
	[keyin1] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[customize_data] [nvarchar](max) NULL,
	[printed_files] [nvarchar](max) NULL,
	[UpdateTime] [datetime2](7) NULL,
 CONSTRAINT [PK_pro_order2] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[報名明細查詢]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[報名明細查詢]
AS
SELECT  dbo.followers.num AS followers_num, dbo.followers.f_number, dbo.followers.u_name, dbo.activity.num AS activity_num, dbo.activity.subject, 
               dbo.pro_order.order_no, dbo.pro_order.up_time, dbo.pro_order.reg_time, dbo.pro_order_detail.num AS pro_order_detail_num, 
               dbo.pro_order_detail.actItem_num, dbo.actItem.subject AS actItem_subject, dbo.pro_order_detail.price, dbo.pro_order_detail.qty
FROM     dbo.pro_order_detail INNER JOIN
               dbo.pro_order ON dbo.pro_order_detail.order_no = dbo.pro_order.order_no INNER JOIN
               dbo.actItem ON dbo.pro_order_detail.actItem_num = dbo.actItem.num INNER JOIN
               dbo.activity ON dbo.pro_order.activity_num = dbo.activity.num INNER JOIN
               dbo.followers ON dbo.pro_order.f_num = dbo.followers.num
GO
/****** Object:  Table [dbo].[accounting]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[accounting](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[uptime] [datetime] NULL,
	[category] [int] NULL,
	[kind] [int] NULL,
	[kind2] [int] NULL,
	[price] [real] NULL,
	[tax] [real] NULL,
	[demo] [nvarchar](max) NULL,
	[mem_num] [int] NULL,
	[debtor] [nvarchar](20) NULL,
	[activity_num] [int] NULL,
	[excerpt] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[pro_order_detail_num] [int] NULL,
 CONSTRAINT [PK_accounting] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[accounting_files]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[accounting_files](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[accounting_num] [int] NULL,
	[reg_time] [datetime] NULL,
	[pic1] [nvarchar](50) NULL,
	[pic1_name] [nvarchar](150) NULL,
 CONSTRAINT [PK_accounting_files] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[accounting_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[accounting_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[title] [nvarchar](30) NULL,
 CONSTRAINT [PK_accounting_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[accounting_kind2]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[accounting_kind2](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[title] [nvarchar](30) NULL,
	[bank_name] [nvarchar](30) NULL,
	[bank_code] [nvarchar](30) NULL,
	[bank_id] [nvarchar](30) NULL,
	[record_payment] [nvarchar](1) NULL,
 CONSTRAINT [PK_accounting_kind2] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[act_bom]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[act_bom](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[package_num] [int] NULL,
	[item_num] [int] NULL,
	[item_type] [int] NULL,
	[group_name] [nvarchar](100) NULL,
	[optional] [bit] NULL,
	[qty] [int] NULL,
	[memo] [nvarchar](max) NULL,
 CONSTRAINT [PK_act_bom] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[actItem_files]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[actItem_files](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[actItem_num] [int] NOT NULL,
	[files_num] [int] NOT NULL,
	[reg_time] [datetime] NULL,
 CONSTRAINT [PK_actItem_files] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[actItem_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[actItem_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[status] [nvarchar](1) NULL,
 CONSTRAINT [PK_actItem_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[activity_category_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity_category_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
 CONSTRAINT [PK_activity_category_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[activity_check]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity_check](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[f_num] [int] NULL,
	[activity_num] [int] NULL,
	[reg_time] [datetime] NULL,
	[status] [int] NULL,
	[qty] [int] NULL,
 CONSTRAINT [PK_activity_check] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[activity_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[calendar] [nvarchar](2) NULL,
	[month] [int] NULL,
	[day] [int] NULL,
 CONSTRAINT [PK_activity_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[activity_kind_detail]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity_kind_detail](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[activity_kind_num] [int] NOT NULL,
	[actItem_num] [int] NOT NULL,
	[price] [real] NULL,
	[qty] [int] NULL,
	[reg_time] [datetime] NULL,
 CONSTRAINT [PK_activity_kind_detail] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[activity_relating]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity_relating](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[activity_num] [int] NOT NULL,
	[actItem_num] [int] NOT NULL,
	[price] [real] NULL,
	[qty] [int] NULL,
	[reg_time] [datetime] NULL,
 CONSTRAINT [PK_activity_relating] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[activity_spares]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[activity_spares](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[activity_num] [int] NOT NULL,
	[actItem_num] [int] NOT NULL,
	[qty1] [int] NULL,
	[qty2] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
 CONSTRAINT [PK_activity_spares] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[admin]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[admin](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[u_id] [nvarchar](50) NULL,
	[u_password] [nvarchar](max) NULL,
	[u_name] [nvarchar](50) NULL,
	[sex] [nvarchar](2) NULL,
	[kind] [nvarchar](10) NULL,
	[phone1] [nvarchar](50) NULL,
	[phone2] [nvarchar](50) NULL,
	[birthday] [datetime] NULL,
	[email] [nvarchar](200) NULL,
	[city] [nvarchar](10) NULL,
	[area] [nvarchar](50) NULL,
	[address] [nvarchar](255) NULL,
	[uid] [nvarchar](20) NULL,
	[demo] [nvarchar](max) NULL,
	[power] [nvarchar](3) NULL,
	[online] [bit] NOT NULL,
	[reg_time] [datetime] NULL,
	[login_time] [datetime] NULL,
	[login_ip] [nvarchar](50) NULL,
	[login_code] [nvarchar](10) NULL,
	[adwidth] [nvarchar](10) NULL,
	[wrp_news] [nvarchar](1) NULL,
	[wrp_bar] [nvarchar](1) NULL,
	[gauth_key] [nvarchar](max) NULL,
	[gauth_enabled] [bit] NULL,
 CONSTRAINT [PK_admin] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[admin_group]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[admin_group](
	[g_name] [nvarchar](3) NOT NULL,
	[items] [nvarchar](255) NULL,
	[demo] [nvarchar](100) NULL,
 CONSTRAINT [PK_admin_group_1] PRIMARY KEY CLUSTERED 
(
	[g_name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[admin_log]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[admin_log](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[u_id] [nvarchar](50) NULL,
	[login_time] [datetime] NULL,
	[login_ip] [nvarchar](50) NULL,
	[status] [int] NULL,
	[agent] [nvarchar](5) NULL,
	[word] [nvarchar](max) NULL,
	[systems] [int] NULL,
 CONSTRAINT [PK_admin_log] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[appellation]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[appellation](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[title] [nvarchar](10) NULL,
 CONSTRAINT [PK_appellation] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[bed_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[bed_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[sex] [nvarchar](2) NULL,
 CONSTRAINT [PK_bed_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[bed_kind_detail]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[bed_kind_detail](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[bed_kind_id] [int] NULL,
	[bed_name] [nvarchar](50) NULL,
	[bed_type] [int] NULL,
	[demo] [nvarchar](max) NULL,
 CONSTRAINT [PK_bed_kind_detail] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[bed_order]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[bed_order](
	[bed_order_no] [nvarchar](20) NOT NULL,
	[order_no] [nvarchar](20) NULL,
	[o_detail_id] [int] NULL,
	[start_date] [datetime] NULL,
	[end_date] [datetime] NULL,
	[phone] [nvarchar](max) NULL,
	[keyin1] [nvarchar](2) NULL,
	[demo] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
 CONSTRAINT [PK_bed_order_1] PRIMARY KEY CLUSTERED 
(
	[bed_order_no] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[bed_order_detail]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[bed_order_detail](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[bed_order_no] [nvarchar](20) NULL,
	[checkIn_date] [datetime] NULL,
	[bed_kind1] [int] NULL,
	[bed_kind2] [int] NULL,
	[bed_kind_detail_id] [int] NULL,
	[license] [nvarchar](10) NULL,
 CONSTRAINT [PK_bed_order_detail] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[company]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[company](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[com_name] [nvarchar](20) NULL,
	[com_mail] [nvarchar](200) NULL,
	[bcc_mail] [nvarchar](max) NULL,
	[pic_url] [nvarchar](200) NULL,
	[menu] [bit] NULL,
	[log_class] [bit] NULL,
	[log_menu] [nvarchar](20) NULL,
	[last_order_no] [nvarchar](20) NULL,
	[adwidth] [nvarchar](10) NULL,
	[wrp_news] [nvarchar](1) NULL,
	[wrp_bar] [nvarchar](1) NULL,
	[smtp_url] [nvarchar](50) NULL,
	[smtp_port] [nvarchar](10) NULL,
	[smtp_ssl] [nvarchar](1) NULL,
	[smtp_user] [nvarchar](50) NULL,
	[smtp_password] [nvarchar](max) NULL,
	[smtp_def] [nvarchar](1) NULL,
	[use_sender] [nvarchar](1) NULL,
	[bed_order_no] [nvarchar](20) NULL,
 CONSTRAINT [PK_company] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[country]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[country](
	[ID] [nvarchar](5) NOT NULL,
	[ID2] [nvarchar](5) NULL,
	[ID3] [nvarchar](5) NULL,
	[range] [int] NULL,
	[name_en] [nvarchar](100) NULL,
	[name_zh] [nvarchar](30) NULL,
 CONSTRAINT [PK_country] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[family_members]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[family_members](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[follower_num] [int] NOT NULL,
	[fam_name] [nvarchar](255) NOT NULL,
	[fam_gender] [nvarchar](10) NULL,
	[fam_title] [nvarchar](30) NULL,
	[deceased] [bit] NULL,
	[birthdate] [date] NULL,
	[lunar_birthday] [nvarchar](30) NULL,
	[age] [nvarchar](10) NULL,
	[zodiac] [nvarchar](10) NULL,
	[birth_time] [nvarchar](10) NULL,
	[city] [nvarchar](255) NULL,
	[area] [nvarchar](255) NULL,
	[address] [nvarchar](255) NULL,
	[phone] [nvarchar](20) NULL,
	[mobile] [nvarchar](20) NULL,
 CONSTRAINT [PK__family_m__DF908D65D8141140] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[files]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[files](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[subject] [nvarchar](50) NULL,
	[word] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[modify_time] [datetime] NULL,
	[customize_data] [nvarchar](max) NULL,
	[paperset] [nvarchar](15) NULL,
 CONSTRAINT [PK_files] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[followers_tablet]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[followers_tablet](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[f_num] [int] NULL,
	[type] [nvarchar](100) NULL,
	[title] [nvarchar](max) NULL,
 CONSTRAINT [PK_followers_tablet] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GuaDanOrder]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GuaDanOrder](
	[StartDate] [date] NULL,
	[EndDate] [date] NULL,
	[CreateUser] [int] NULL,
	[CreatedAt] [datetime2](7) NULL,
	[UpdatedAt] [datetime2](7) NULL,
	[Notes] [nvarchar](100) NULL,
	[GuaDanOrderNo] [nvarchar](20) NOT NULL,
	[BookerFollowerNum] [int] NULL,
	[BookerName] [nvarchar](20) NULL,
	[BookerPhone] [nvarchar](12) NULL,
	[IsDeleted] [bit] NOT NULL,
	[Uuid] [uniqueidentifier] NOT NULL,
	[ActivityNum] [int] NULL,
	[IsCancel] [bit] NOT NULL,
 CONSTRAINT [PK_GuaDanOrder] PRIMARY KEY CLUSTERED 
(
	[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UQ_GuaDanOrderNo] UNIQUE NONCLUSTERED 
(
	[GuaDanOrderNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GuaDanOrderGuest]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GuaDanOrderGuest](
	[GuaDanOrderNo] [nvarchar](20) NOT NULL,
	[FollowerNum] [int] NULL,
	[IsDeleted] [bit] NOT NULL,
	[Uuid] [uniqueidentifier] NOT NULL,
	[RoomUuid] [uniqueidentifier] NULL,
	[BedUuid] [uniqueidentifier] NULL,
	[CheckInAt] [date] NULL,
	[CheckOutAt] [date] NULL,
	[StatusCode] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_GuaDanOrderGuest] PRIMARY KEY CLUSTERED 
(
	[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GuadanTimeSetting]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GuadanTimeSetting](
	[Id] [uniqueidentifier] NOT NULL,
	[EarliestCheckIn] [nvarchar](5) NOT NULL,
	[LatestCheckOut] [nvarchar](5) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CreatedAt] [datetime] NULL,
	[UpdatedAt] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[item]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[item](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[title] [nvarchar](50) NULL,
	[url] [nvarchar](100) NULL,
	[target] [nvarchar](2) NULL,
	[price] [nvarchar](10) NULL,
	[demo] [nvarchar](255) NULL,
	[other] [nvarchar](255) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[other_url] [nvarchar](255) NULL,
	[s_id] [nvarchar](10) NULL,
 CONSTRAINT [PK_item] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[member]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[member](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[f_num] [int] NULL,
	[m_number] [nvarchar](20) NULL,
	[u_name] [nvarchar](20) NULL,
	[sex] [nvarchar](2) NULL,
	[id_code] [nvarchar](max) NULL,
	[birthday] [datetime] NULL,
	[blood] [nvarchar](2) NULL,
	[educational] [nvarchar](50) NULL,
	[refugedate] [datetime] NULL,
	[refuge_name] [nvarchar](20) NULL,
	[refuge_area] [nvarchar](50) NULL,
	[demo] [nvarchar](max) NULL,
	[admin_num] [int] NULL,
	[takedate] [datetime] NULL,
	[leavedate] [datetime] NULL,
	[group_kind] [int] NULL,
	[title_kind] [int] NULL,
	[salary] [real] NULL,
	[phone] [nvarchar](max) NULL,
	[com_email] [nvarchar](200) NULL,
	[email] [nvarchar](200) NULL,
	[contact] [nvarchar](100) NULL,
	[address1] [nvarchar](200) NULL,
	[address2] [nvarchar](200) NULL,
	[reg_time] [datetime] NULL,
	[pic1] [nvarchar](50) NULL,
 CONSTRAINT [PK_member] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[member_check]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[member_check](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[mem_num] [int] NULL,
	[check_date] [date] NULL,
	[check_time] [time](3) NULL,
	[check_type] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[login_type] [int] NULL,
	[login_ip] [nvarchar](50) NULL,
	[hour] [int] NULL,
 CONSTRAINT [PK_member_check] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[member_group]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[member_group](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[starttime] [time](0) NULL,
	[offtime] [time](0) NULL,
	[resttime] [int] NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
 CONSTRAINT [PK_member_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[member_title]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[member_title](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[status] [nvarchar](1) NULL,
 CONSTRAINT [PK_member_title] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[news]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[news](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[subject] [nvarchar](100) NULL,
	[kind] [int] NULL,
	[status] [nvarchar](1) NULL,
	[selltime1] [datetime] NULL,
	[selltime2] [datetime] NULL,
	[uptime] [datetime] NULL,
	[topping] [nvarchar](1) NULL,
	[demo] [nvarchar](max) NULL,
	[word] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[range] [int] NULL,
	[author] [int] NULL,
	[activity_num] [int] NULL,
 CONSTRAINT [PK_news] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[news_files]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[news_files](
	[num] [nvarchar](14) NOT NULL,
	[news_id] [int] NOT NULL,
	[pic1] [nvarchar](50) NULL,
	[reg_time] [datetime] NULL,
	[pic_name] [nvarchar](150) NULL,
	[pic_type] [nvarchar](10) NULL,
 CONSTRAINT [PK_news_files_1] PRIMARY KEY CLUSTERED 
(
	[num] ASC,
	[news_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[news_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[news_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[status] [nvarchar](1) NULL,
 CONSTRAINT [PK_news_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PostCity]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PostCity](
	[city] [nvarchar](10) NOT NULL,
 CONSTRAINT [PK_PostCity] PRIMARY KEY CLUSTERED 
(
	[city] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PostNumber]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PostNumber](
	[ID] [int] NOT NULL,
	[PostNumber] [nvarchar](255) NULL,
	[City] [nvarchar](255) NULL,
	[Area] [nvarchar](255) NULL,
 CONSTRAINT [PK_PostNumber] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[pro_order_record]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[pro_order_record](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[detail_num] [int] NULL,
	[price] [real] NULL,
	[payment] [int] NULL,
	[reg_time] [datetime] NULL,
	[pay_date] [datetime] NULL,
	[organization] [nvarchar](50) NULL,
	[bank_code] [nvarchar](10) NULL,
	[transfer_id] [int] NULL,
	[reconcile_memo] [nvarchar](max) NULL,
 CONSTRAINT [PK_pro_order_record] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[project]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[project](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[subject] [nvarchar](50) NULL,
	[kind] [int] NULL,
	[actItem_num] [int] NULL,
	[demo] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
 CONSTRAINT [PK_project1] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[project_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[project_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
 CONSTRAINT [PK_project] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[project_sub]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[project_sub](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[subject] [nvarchar](50) NULL,
	[uptime] [datetime] NULL,
	[reg_time] [datetime] NULL,
	[word] [nvarchar](max) NULL,
	[pic1] [nvarchar](50) NULL,
	[pro_id] [int] NULL,
 CONSTRAINT [PK_project_sub] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Region]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Region](
	[Name] [nvarchar](100) NOT NULL,
	[Description] [nvarchar](200) NULL,
	[SortOrder] [int] NULL,
	[CreatedBy] [nvarchar](50) NULL,
	[CreatedAt] [datetime] NULL,
	[UpdatedAt] [datetime] NULL,
	[IsActive] [bit] NOT NULL,
	[RoomCount] [int] NULL,
	[IsDeleted] [bit] NOT NULL,
	[Uuid] [uniqueidentifier] NOT NULL,
	[ParentUuid] [uniqueidentifier] NULL,
	[RegionTypeUuid] [uniqueidentifier] NULL,
	[Gender] [bit] NULL,
 CONSTRAINT [PK_Region] PRIMARY KEY CLUSTERED 
(
	[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RegionAndRoomAndBedSchedule]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RegionAndRoomAndBedSchedule](
	[UseType] [int] NOT NULL,
	[Title] [nvarchar](100) NULL,
	[Description] [nvarchar](100) NULL,
	[CreatedBy] [nvarchar](100) NULL,
	[CreatedAt] [datetime2](7) NULL,
	[IsDeleted] [bit] NOT NULL,
	[Uuid] [uniqueidentifier] NOT NULL,
	[TargetUuid] [uniqueidentifier] NULL,
	[GuaDanOrderNo] [nvarchar](20) NULL,
	[ScheduleDate] [date] NULL,
	[IsCancel] [bit] NOT NULL,
	[GuaDanOrderGuestUuid] [uniqueidentifier] NULL,
 CONSTRAINT [PK_RegionAndRoomAndBedSchedule] PRIMARY KEY CLUSTERED 
(
	[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RegionRoomBed]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RegionRoomBed](
	[Name] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Gender] [bit] NOT NULL,
	[IsDeleted] [bit] NOT NULL,
	[Uuid] [uniqueidentifier] NOT NULL,
	[RoomUuid] [uniqueidentifier] NOT NULL,
	[StatusCode] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_RegionRoomBed] PRIMARY KEY CLUSTERED 
(
	[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RegionRoomBedStatus]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RegionRoomBedStatus](
	[Code] [nvarchar](20) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Description] [nvarchar](50) NULL,
	[Category] [int] NULL,
	[IsDeleted] [bit] NOT NULL,
 CONSTRAINT [PK_RegionRoomBedStatus] PRIMARY KEY CLUSTERED 
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RegionType]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RegionType](
	[Code] [varchar](20) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CreateAt] [datetime] NULL,
	[IsDeleted] [bit] NOT NULL,
	[Uuid] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK__RegionTy__3214EC07ACAB030A] PRIMARY KEY CLUSTERED 
(
	[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Room]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Room](
	[Name] [nvarchar](50) NULL,
	[Gender] [bit] NOT NULL,
	[BedCount] [int] NULL,
	[IsActive] [bit] NULL,
	[CreatedAt] [datetime] NULL,
	[UpdatedAt] [datetime] NULL,
	[IsDeleted] [bit] NOT NULL,
	[Uuid] [uniqueidentifier] NOT NULL,
	[RegionUuid] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK__Room__3214EC0730203C74] PRIMARY KEY CLUSTERED 
(
	[Uuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ShuWen]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ShuWen](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ActivityNum] [int] NOT NULL,
	[CreateTime] [datetime2](7) NOT NULL,
	[UpdateTime] [datetime2](7) NOT NULL,
	[ShuWenList] [nvarchar](max) NULL,
	[IsGenerating] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[stock]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[stock](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[uptime] [datetime] NULL,
	[category] [int] NULL,
	[kind] [int] NULL,
	[activity_num] [int] NULL,
	[actItem_num] [int] NULL,
	[qty] [int] NULL,
	[price] [real] NULL,
	[demo] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[mem_num] [int] NULL,
	[debtor] [nvarchar](20) NULL,
	[balances] [int] NULL,
	[reason] [int] NULL,
	[supplier] [int] NULL,
	[final_stock] [int] NULL,
	[rent_stock] [int] NULL,
 CONSTRAINT [PK_stock] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[stock_files]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[stock_files](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[stock_num] [int] NULL,
	[reg_time] [datetime] NULL,
	[pic1] [nvarchar](50) NULL,
	[pic1_name] [nvarchar](150) NULL,
 CONSTRAINT [PK_stock_files] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[stock_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[stock_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
 CONSTRAINT [PK_stock_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[stock_reason]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[stock_reason](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[category] [int] NULL,
 CONSTRAINT [PK_stock_reason] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[supplier]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[supplier](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[s_number] [nvarchar](20) NULL,
	[u_name] [nvarchar](20) NULL,
	[kind] [int] NULL,
	[phone2] [nvarchar](max) NULL,
	[phone1] [nvarchar](max) NULL,
	[address] [nvarchar](200) NULL,
	[fax] [nvarchar](max) NULL,
	[email] [nvarchar](200) NULL,
	[url] [nvarchar](max) NULL,
	[pic1] [nvarchar](50) NULL,
	[demo] [nvarchar](max) NULL,
	[reg_time] [datetime] NULL,
	[admin_log] [nvarchar](50) NULL,
	[c_num] [nvarchar](8) NULL,
 CONSTRAINT [PK_supplier] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[supplier_kind]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[supplier_kind](
	[num] [int] IDENTITY(1,1) NOT NULL,
	[kind] [nvarchar](100) NULL,
	[root] [int] NULL,
	[range] [int] NULL,
	[demo] [nvarchar](max) NULL,
 CONSTRAINT [PK_supplier_kind] PRIMARY KEY CLUSTERED 
(
	[num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[transfer_register]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[transfer_register](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[activity_num] [int] NULL,
	[name] [nvarchar](50) NULL,
	[phone] [nvarchar](30) NULL,
	[pay_type] [nvarchar](20) NULL,
	[account_last5] [nvarchar](10) NULL,
	[amount] [decimal](12, 2) NULL,
	[pay_mode] [nvarchar](10) NULL,
	[note] [nvarchar](200) NULL,
	[proof_img] [nvarchar](200) NULL,
	[status] [nvarchar](20) NULL,
	[create_time] [datetime] NULL,
	[f_num_match] [int] NULL,
	[f_num] [int] NULL,
	[acc_num] [int] NULL,
	[check_date] [datetime] NULL,
	[check_amount] [decimal](12, 2) NULL,
	[check_memo] [nvarchar](200) NULL,
	[check_status] [nvarchar](20) NULL,
	[acc_kind] [int] NULL,
	[member_num] [int] NULL,
	[verify_time] [datetime] NULL,
	[verify_note] [nvarchar](200) NULL,
	[remain_amount] [decimal](12, 2) NULL,
	[draft] [nvarchar](max) NULL,
	[balance_act_item] [int] NULL,
	[balance_pro_order_detail] [int] NULL,
 CONSTRAINT [PK__transfer__3213E83F082312F3] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[accounting] ADD  CONSTRAINT [DF_accounting_uptime]  DEFAULT (CONVERT([varchar],getdate(),(111))) FOR [uptime]
GO
ALTER TABLE [dbo].[accounting] ADD  CONSTRAINT [DF_accounting_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[accounting_files] ADD  CONSTRAINT [DF_accounting_files_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[accounting_kind] ADD  CONSTRAINT [DF_accounting_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[accounting_kind2] ADD  CONSTRAINT [DF_accounting_kind2_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[actItem] ADD  CONSTRAINT [DF_actItem_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[actItem_files] ADD  CONSTRAINT [DF_acrItem_files_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[actItem_kind] ADD  CONSTRAINT [DF_actItem_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[activity] ADD  CONSTRAINT [DF_activity_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[activity_category_kind] ADD  CONSTRAINT [DF_activity_category_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[activity_check] ADD  CONSTRAINT [DF_activity_check_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[activity_kind] ADD  CONSTRAINT [DF_activity_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[activity_kind_detail] ADD  CONSTRAINT [DF_activity_detail_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[activity_relating] ADD  CONSTRAINT [DF_activity_relating_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[activity_spares] ADD  CONSTRAINT [DF_activity_spares_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[admin] ADD  CONSTRAINT [DF_admin_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[admin] ADD  CONSTRAINT [DF_admin_wrp_news]  DEFAULT (N'Y') FOR [wrp_news]
GO
ALTER TABLE [dbo].[admin] ADD  CONSTRAINT [DF_admin_wrp_bar]  DEFAULT (N'Y') FOR [wrp_bar]
GO
ALTER TABLE [dbo].[admin_log] ADD  CONSTRAINT [DF_admin_log_login_time]  DEFAULT (getdate()) FOR [login_time]
GO
ALTER TABLE [dbo].[bed_kind] ADD  CONSTRAINT [DF_bed_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[bed_order] ADD  CONSTRAINT [DF_bed_order_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_company_wrp_news]  DEFAULT (N'Y') FOR [wrp_news]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_company_wrp_bar]  DEFAULT (N'Y') FOR [wrp_bar]
GO
ALTER TABLE [dbo].[family_members] ADD  CONSTRAINT [DF__family_me__decea__0E7913B7]  DEFAULT ((0)) FOR [deceased]
GO
ALTER TABLE [dbo].[files] ADD  CONSTRAINT [DF_files_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[followers] ADD  CONSTRAINT [DF_followers_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[GuaDanOrder] ADD  CONSTRAINT [DF__GuaDanOrd__IsDel__5C6CB6D7]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[GuaDanOrder] ADD  DEFAULT ((0)) FOR [IsCancel]
GO
ALTER TABLE [dbo].[GuaDanOrderGuest] ADD  CONSTRAINT [DF__GuaDanOrd__IsDel__5B78929E]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[GuaDanOrderGuest] ADD  CONSTRAINT [DF__GuaDanOrde__Uuid__5E54FF49]  DEFAULT (newid()) FOR [Uuid]
GO
ALTER TABLE [dbo].[GuadanTimeSetting] ADD  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[item] ADD  CONSTRAINT [DF_item_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[member] ADD  CONSTRAINT [DF_member_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[member_group] ADD  CONSTRAINT [DF_member_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[member_title] ADD  CONSTRAINT [DF_member_title_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[news] ADD  CONSTRAINT [DF_news_uptime]  DEFAULT (CONVERT([varchar],getdate(),(111))) FOR [uptime]
GO
ALTER TABLE [dbo].[news] ADD  CONSTRAINT [DF_news_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[news_files] ADD  CONSTRAINT [DF_news_files_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[news_kind] ADD  CONSTRAINT [DF_news_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[pro_order] ADD  CONSTRAINT [DF_Table_1_up_time1]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[pro_order_record] ADD  CONSTRAINT [DF_pro_order_record_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[project] ADD  CONSTRAINT [DF_project1_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[project_kind] ADD  CONSTRAINT [DF_project_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[project_sub] ADD  CONSTRAINT [DF_project_sub_uptime]  DEFAULT (CONVERT([varchar],getdate(),(111))) FOR [uptime]
GO
ALTER TABLE [dbo].[project_sub] ADD  CONSTRAINT [DF_project_sub_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[Region] ADD  CONSTRAINT [DF__Region__SortOrde__10216507]  DEFAULT ((0)) FOR [SortOrder]
GO
ALTER TABLE [dbo].[Region] ADD  CONSTRAINT [DF__Region__IsActive__16CE6296]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[Region] ADD  CONSTRAINT [DF__Region__IsDelete__5D60DB10]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[RegionAndRoomAndBedSchedule] ADD  CONSTRAINT [DF__RegionAnd__IsDel__51EF2864]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[RegionAndRoomAndBedSchedule] ADD  CONSTRAINT [DF__RegionAndR__Uuid__6319B466]  DEFAULT (newid()) FOR [Uuid]
GO
ALTER TABLE [dbo].[RegionAndRoomAndBedSchedule] ADD  DEFAULT ((0)) FOR [IsCancel]
GO
ALTER TABLE [dbo].[RegionRoomBed] ADD  CONSTRAINT [DF__RegionRoo__IsAct__1A9EF37A]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[RegionRoomBed] ADD  CONSTRAINT [DF__RegionRoo__Gende__2057CCD0]  DEFAULT ((1)) FOR [Gender]
GO
ALTER TABLE [dbo].[RegionRoomBed] ADD  CONSTRAINT [DF__RegionRoo__IsDel__57A801BA]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[RegionRoomBed] ADD  CONSTRAINT [DF__RegionRoom__Uuid__6501FCD8]  DEFAULT (newid()) FOR [Uuid]
GO
ALTER TABLE [dbo].[RegionRoomBedStatus] ADD  CONSTRAINT [DF__RegionRoo__IsDel__589C25F3]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[RegionType] ADD  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[RegionType] ADD  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[RegionType] ADD  DEFAULT (newid()) FOR [Uuid]
GO
ALTER TABLE [dbo].[Room] ADD  CONSTRAINT [DF__Room__IsActive__2CBDA3B5]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[Room] ADD  CONSTRAINT [DF__Room__CreatedAt__2DB1C7EE]  DEFAULT (NULL) FOR [CreatedAt]
GO
ALTER TABLE [dbo].[Room] ADD  CONSTRAINT [DF__Room__IsDeleted__5A846E65]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[Room] ADD  CONSTRAINT [DF__Room__Uuid__6225902D]  DEFAULT (newid()) FOR [Uuid]
GO
ALTER TABLE [dbo].[ShuWen] ADD  DEFAULT ((0)) FOR [IsGenerating]
GO
ALTER TABLE [dbo].[stock] ADD  CONSTRAINT [DF_stock_uptime]  DEFAULT (CONVERT([varchar],getdate(),(111))) FOR [uptime]
GO
ALTER TABLE [dbo].[stock] ADD  CONSTRAINT [DF_stock_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[stock_files] ADD  CONSTRAINT [DF_stock_files_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[stock_kind] ADD  CONSTRAINT [DF_stock_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[stock_reason] ADD  CONSTRAINT [DF_stock_reason_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[supplier] ADD  CONSTRAINT [DF_supplier_reg_time]  DEFAULT (getdate()) FOR [reg_time]
GO
ALTER TABLE [dbo].[supplier_kind] ADD  CONSTRAINT [DF_supplier_kind_root]  DEFAULT ((0)) FOR [root]
GO
ALTER TABLE [dbo].[accounting]  WITH CHECK ADD  CONSTRAINT [FK_accounting_accounting_kind] FOREIGN KEY([kind])
REFERENCES [dbo].[accounting_kind] ([num])
GO
ALTER TABLE [dbo].[accounting] CHECK CONSTRAINT [FK_accounting_accounting_kind]
GO
ALTER TABLE [dbo].[accounting]  WITH CHECK ADD  CONSTRAINT [FK_accounting_accounting_kind2] FOREIGN KEY([kind2])
REFERENCES [dbo].[accounting_kind2] ([num])
GO
ALTER TABLE [dbo].[accounting] CHECK CONSTRAINT [FK_accounting_accounting_kind2]
GO
ALTER TABLE [dbo].[accounting]  WITH CHECK ADD  CONSTRAINT [FK_accounting_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[accounting] CHECK CONSTRAINT [FK_accounting_activity]
GO
ALTER TABLE [dbo].[accounting]  WITH CHECK ADD  CONSTRAINT [FK_accounting_member] FOREIGN KEY([mem_num])
REFERENCES [dbo].[member] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[accounting] CHECK CONSTRAINT [FK_accounting_member]
GO
ALTER TABLE [dbo].[accounting]  WITH CHECK ADD  CONSTRAINT [FK_accounting_pro_order_detail] FOREIGN KEY([pro_order_detail_num])
REFERENCES [dbo].[pro_order_detail] ([num])
GO
ALTER TABLE [dbo].[accounting] CHECK CONSTRAINT [FK_accounting_pro_order_detail]
GO
ALTER TABLE [dbo].[accounting_files]  WITH CHECK ADD  CONSTRAINT [FK_accounting_files_accounting] FOREIGN KEY([accounting_num])
REFERENCES [dbo].[accounting] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[accounting_files] CHECK CONSTRAINT [FK_accounting_files_accounting]
GO
ALTER TABLE [dbo].[act_bom]  WITH CHECK ADD  CONSTRAINT [FK_act_bom_act_bom] FOREIGN KEY([package_num])
REFERENCES [dbo].[act_bom] ([num])
GO
ALTER TABLE [dbo].[act_bom] CHECK CONSTRAINT [FK_act_bom_act_bom]
GO
ALTER TABLE [dbo].[act_bom]  WITH CHECK ADD  CONSTRAINT [FK_act_bom_actItem1] FOREIGN KEY([item_num])
REFERENCES [dbo].[actItem] ([num])
GO
ALTER TABLE [dbo].[act_bom] CHECK CONSTRAINT [FK_act_bom_actItem1]
GO
ALTER TABLE [dbo].[actItem]  WITH CHECK ADD  CONSTRAINT [FK_actItem_actItem_kind] FOREIGN KEY([kind])
REFERENCES [dbo].[actItem_kind] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[actItem] CHECK CONSTRAINT [FK_actItem_actItem_kind]
GO
ALTER TABLE [dbo].[actItem_files]  WITH CHECK ADD  CONSTRAINT [FK_actItem_files_actItem] FOREIGN KEY([actItem_num])
REFERENCES [dbo].[actItem] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[actItem_files] CHECK CONSTRAINT [FK_actItem_files_actItem]
GO
ALTER TABLE [dbo].[activity]  WITH CHECK ADD  CONSTRAINT [FK_activity_activity_category_kind] FOREIGN KEY([category_kind])
REFERENCES [dbo].[activity_category_kind] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[activity] CHECK CONSTRAINT [FK_activity_activity_category_kind]
GO
ALTER TABLE [dbo].[activity]  WITH CHECK ADD  CONSTRAINT [FK_activity_activity_kind] FOREIGN KEY([kind])
REFERENCES [dbo].[activity_kind] ([num])
GO
ALTER TABLE [dbo].[activity] CHECK CONSTRAINT [FK_activity_activity_kind]
GO
ALTER TABLE [dbo].[activity_check]  WITH CHECK ADD  CONSTRAINT [FK_activity_check_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[activity_check] CHECK CONSTRAINT [FK_activity_check_activity]
GO
ALTER TABLE [dbo].[activity_check]  WITH CHECK ADD  CONSTRAINT [FK_activity_check_followers] FOREIGN KEY([f_num])
REFERENCES [dbo].[followers] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[activity_check] CHECK CONSTRAINT [FK_activity_check_followers]
GO
ALTER TABLE [dbo].[activity_kind_detail]  WITH CHECK ADD  CONSTRAINT [FK_activity_kind_detail_actItem] FOREIGN KEY([actItem_num])
REFERENCES [dbo].[actItem] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[activity_kind_detail] CHECK CONSTRAINT [FK_activity_kind_detail_actItem]
GO
ALTER TABLE [dbo].[activity_kind_detail]  WITH CHECK ADD  CONSTRAINT [FK_activity_kind_detail_activity_kind] FOREIGN KEY([activity_kind_num])
REFERENCES [dbo].[activity_kind] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[activity_kind_detail] CHECK CONSTRAINT [FK_activity_kind_detail_activity_kind]
GO
ALTER TABLE [dbo].[activity_relating]  WITH CHECK ADD  CONSTRAINT [FK_activity_relating_actItem] FOREIGN KEY([actItem_num])
REFERENCES [dbo].[actItem] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[activity_relating] CHECK CONSTRAINT [FK_activity_relating_actItem]
GO
ALTER TABLE [dbo].[activity_relating]  WITH CHECK ADD  CONSTRAINT [FK_activity_relating_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
GO
ALTER TABLE [dbo].[activity_relating] CHECK CONSTRAINT [FK_activity_relating_activity]
GO
ALTER TABLE [dbo].[activity_spares]  WITH CHECK ADD  CONSTRAINT [FK_activity_spares_actItem] FOREIGN KEY([actItem_num])
REFERENCES [dbo].[actItem] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[activity_spares] CHECK CONSTRAINT [FK_activity_spares_actItem]
GO
ALTER TABLE [dbo].[activity_spares]  WITH CHECK ADD  CONSTRAINT [FK_activity_spares_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
GO
ALTER TABLE [dbo].[activity_spares] CHECK CONSTRAINT [FK_activity_spares_activity]
GO
ALTER TABLE [dbo].[admin]  WITH CHECK ADD  CONSTRAINT [FK_admin_admin_group] FOREIGN KEY([power])
REFERENCES [dbo].[admin_group] ([g_name])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[admin] CHECK CONSTRAINT [FK_admin_admin_group]
GO
ALTER TABLE [dbo].[bed_kind_detail]  WITH CHECK ADD  CONSTRAINT [FK_bed_kind_detail_bed_kind] FOREIGN KEY([bed_kind_id])
REFERENCES [dbo].[bed_kind] ([num])
GO
ALTER TABLE [dbo].[bed_kind_detail] CHECK CONSTRAINT [FK_bed_kind_detail_bed_kind]
GO
ALTER TABLE [dbo].[bed_order]  WITH CHECK ADD  CONSTRAINT [FK_bed_order_pro_order] FOREIGN KEY([order_no])
REFERENCES [dbo].[pro_order] ([order_no])
GO
ALTER TABLE [dbo].[bed_order] CHECK CONSTRAINT [FK_bed_order_pro_order]
GO
ALTER TABLE [dbo].[bed_order]  WITH CHECK ADD  CONSTRAINT [FK_bed_order_pro_order_detail] FOREIGN KEY([o_detail_id])
REFERENCES [dbo].[pro_order_detail] ([num])
GO
ALTER TABLE [dbo].[bed_order] CHECK CONSTRAINT [FK_bed_order_pro_order_detail]
GO
ALTER TABLE [dbo].[bed_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_bed_order_detail_bed_kind] FOREIGN KEY([bed_kind1])
REFERENCES [dbo].[bed_kind] ([num])
GO
ALTER TABLE [dbo].[bed_order_detail] CHECK CONSTRAINT [FK_bed_order_detail_bed_kind]
GO
ALTER TABLE [dbo].[bed_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_bed_order_detail_bed_kind_detail] FOREIGN KEY([bed_kind_detail_id])
REFERENCES [dbo].[bed_kind_detail] ([num])
GO
ALTER TABLE [dbo].[bed_order_detail] CHECK CONSTRAINT [FK_bed_order_detail_bed_kind_detail]
GO
ALTER TABLE [dbo].[bed_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_bed_order_detail_bed_kind1] FOREIGN KEY([bed_kind2])
REFERENCES [dbo].[bed_kind] ([num])
GO
ALTER TABLE [dbo].[bed_order_detail] CHECK CONSTRAINT [FK_bed_order_detail_bed_kind1]
GO
ALTER TABLE [dbo].[bed_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_bed_order_detail_bed_order] FOREIGN KEY([bed_order_no])
REFERENCES [dbo].[bed_order] ([bed_order_no])
GO
ALTER TABLE [dbo].[bed_order_detail] CHECK CONSTRAINT [FK_bed_order_detail_bed_order]
GO
ALTER TABLE [dbo].[family_members]  WITH CHECK ADD  CONSTRAINT [FK_family_members_followers] FOREIGN KEY([follower_num])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[family_members] CHECK CONSTRAINT [FK_family_members_followers]
GO
ALTER TABLE [dbo].[followers]  WITH CHECK ADD  CONSTRAINT [FK_followers_appellation] FOREIGN KEY([appellation_id])
REFERENCES [dbo].[appellation] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[followers] CHECK CONSTRAINT [FK_followers_appellation]
GO
ALTER TABLE [dbo].[followers]  WITH CHECK ADD  CONSTRAINT [FK_followers_country] FOREIGN KEY([country])
REFERENCES [dbo].[country] ([ID])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[followers] CHECK CONSTRAINT [FK_followers_country]
GO
ALTER TABLE [dbo].[followers]  WITH CHECK ADD  CONSTRAINT [FK_followers_followers] FOREIGN KEY([leader])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[followers] CHECK CONSTRAINT [FK_followers_followers]
GO
ALTER TABLE [dbo].[followers_tablet]  WITH CHECK ADD  CONSTRAINT [FK_followers_tablet_followers] FOREIGN KEY([f_num])
REFERENCES [dbo].[followers] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[followers_tablet] CHECK CONSTRAINT [FK_followers_tablet_followers]
GO
ALTER TABLE [dbo].[GuaDanOrder]  WITH CHECK ADD  CONSTRAINT [FK_GuaDanOrder_Admin_CreateUser] FOREIGN KEY([CreateUser])
REFERENCES [dbo].[admin] ([num])
GO
ALTER TABLE [dbo].[GuaDanOrder] CHECK CONSTRAINT [FK_GuaDanOrder_Admin_CreateUser]
GO
ALTER TABLE [dbo].[GuaDanOrder]  WITH CHECK ADD  CONSTRAINT [FK_GuaDanOrder_Followers] FOREIGN KEY([BookerFollowerNum])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[GuaDanOrder] CHECK CONSTRAINT [FK_GuaDanOrder_Followers]
GO
ALTER TABLE [dbo].[GuaDanOrderGuest]  WITH CHECK ADD  CONSTRAINT [FK_GuaDanOrderGuest_BedUuid] FOREIGN KEY([BedUuid])
REFERENCES [dbo].[RegionRoomBed] ([Uuid])
GO
ALTER TABLE [dbo].[GuaDanOrderGuest] CHECK CONSTRAINT [FK_GuaDanOrderGuest_BedUuid]
GO
ALTER TABLE [dbo].[GuaDanOrderGuest]  WITH CHECK ADD  CONSTRAINT [FK_GuaDanOrderGuest_FOLLOWERS] FOREIGN KEY([FollowerNum])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[GuaDanOrderGuest] CHECK CONSTRAINT [FK_GuaDanOrderGuest_FOLLOWERS]
GO
ALTER TABLE [dbo].[GuaDanOrderGuest]  WITH CHECK ADD  CONSTRAINT [FK_GuaDanOrderGuest_RoomUuid] FOREIGN KEY([RoomUuid])
REFERENCES [dbo].[Room] ([Uuid])
GO
ALTER TABLE [dbo].[GuaDanOrderGuest] CHECK CONSTRAINT [FK_GuaDanOrderGuest_RoomUuid]
GO
ALTER TABLE [dbo].[GuaDanOrderGuest]  WITH CHECK ADD  CONSTRAINT [FK_GuaDanOrderGuest_StatusCode] FOREIGN KEY([StatusCode])
REFERENCES [dbo].[RegionRoomBedStatus] ([Code])
GO
ALTER TABLE [dbo].[GuaDanOrderGuest] CHECK CONSTRAINT [FK_GuaDanOrderGuest_StatusCode]
GO
ALTER TABLE [dbo].[member]  WITH CHECK ADD  CONSTRAINT [FK_member_admin] FOREIGN KEY([admin_num])
REFERENCES [dbo].[admin] ([num])
GO
ALTER TABLE [dbo].[member] CHECK CONSTRAINT [FK_member_admin]
GO
ALTER TABLE [dbo].[member]  WITH CHECK ADD  CONSTRAINT [FK_member_followers] FOREIGN KEY([f_num])
REFERENCES [dbo].[followers] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[member] CHECK CONSTRAINT [FK_member_followers]
GO
ALTER TABLE [dbo].[member]  WITH CHECK ADD  CONSTRAINT [FK_member_member_group] FOREIGN KEY([group_kind])
REFERENCES [dbo].[member_group] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[member] CHECK CONSTRAINT [FK_member_member_group]
GO
ALTER TABLE [dbo].[member]  WITH CHECK ADD  CONSTRAINT [FK_member_member_title] FOREIGN KEY([title_kind])
REFERENCES [dbo].[member_title] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[member] CHECK CONSTRAINT [FK_member_member_title]
GO
ALTER TABLE [dbo].[member_check]  WITH CHECK ADD  CONSTRAINT [FK_member_check_member] FOREIGN KEY([mem_num])
REFERENCES [dbo].[member] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[member_check] CHECK CONSTRAINT [FK_member_check_member]
GO
ALTER TABLE [dbo].[news]  WITH CHECK ADD  CONSTRAINT [FK_news_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[news] CHECK CONSTRAINT [FK_news_activity]
GO
ALTER TABLE [dbo].[news]  WITH CHECK ADD  CONSTRAINT [FK_news_admin] FOREIGN KEY([author])
REFERENCES [dbo].[admin] ([num])
GO
ALTER TABLE [dbo].[news] CHECK CONSTRAINT [FK_news_admin]
GO
ALTER TABLE [dbo].[news]  WITH CHECK ADD  CONSTRAINT [FK_news_news_kind] FOREIGN KEY([kind])
REFERENCES [dbo].[news_kind] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[news] CHECK CONSTRAINT [FK_news_news_kind]
GO
ALTER TABLE [dbo].[news_files]  WITH CHECK ADD  CONSTRAINT [FK_news_files_news] FOREIGN KEY([news_id])
REFERENCES [dbo].[news] ([num])
GO
ALTER TABLE [dbo].[news_files] CHECK CONSTRAINT [FK_news_files_news]
GO
ALTER TABLE [dbo].[pro_order]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
GO
ALTER TABLE [dbo].[pro_order] CHECK CONSTRAINT [FK_pro_order_activity]
GO
ALTER TABLE [dbo].[pro_order]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_followers] FOREIGN KEY([f_num])
REFERENCES [dbo].[followers] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[pro_order] CHECK CONSTRAINT [FK_pro_order_followers]
GO
ALTER TABLE [dbo].[pro_order]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_introducer] FOREIGN KEY([introducer])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[pro_order] CHECK CONSTRAINT [FK_pro_order_introducer]
GO
ALTER TABLE [dbo].[pro_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_detail_actItem] FOREIGN KEY([actItem_num])
REFERENCES [dbo].[actItem] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[pro_order_detail] CHECK CONSTRAINT [FK_pro_order_detail_actItem]
GO
ALTER TABLE [dbo].[pro_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_detail_followers] FOREIGN KEY([f_num])
REFERENCES [dbo].[followers] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[pro_order_detail] CHECK CONSTRAINT [FK_pro_order_detail_followers]
GO
ALTER TABLE [dbo].[pro_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_detail_followers1] FOREIGN KEY([from_id])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[pro_order_detail] CHECK CONSTRAINT [FK_pro_order_detail_followers1]
GO
ALTER TABLE [dbo].[pro_order_detail]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_detail_pro_order] FOREIGN KEY([order_no])
REFERENCES [dbo].[pro_order] ([order_no])
GO
ALTER TABLE [dbo].[pro_order_detail] CHECK CONSTRAINT [FK_pro_order_detail_pro_order]
GO
ALTER TABLE [dbo].[pro_order_record]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_record_accounting_kind2] FOREIGN KEY([payment])
REFERENCES [dbo].[accounting_kind2] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[pro_order_record] CHECK CONSTRAINT [FK_pro_order_record_accounting_kind2]
GO
ALTER TABLE [dbo].[pro_order_record]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_record_pro_order_detail] FOREIGN KEY([detail_num])
REFERENCES [dbo].[pro_order_detail] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[pro_order_record] CHECK CONSTRAINT [FK_pro_order_record_pro_order_detail]
GO
ALTER TABLE [dbo].[pro_order_record]  WITH CHECK ADD  CONSTRAINT [FK_pro_order_record_transfer_register] FOREIGN KEY([transfer_id])
REFERENCES [dbo].[transfer_register] ([id])
GO
ALTER TABLE [dbo].[pro_order_record] CHECK CONSTRAINT [FK_pro_order_record_transfer_register]
GO
ALTER TABLE [dbo].[project]  WITH CHECK ADD  CONSTRAINT [FK_project_actItem] FOREIGN KEY([actItem_num])
REFERENCES [dbo].[actItem] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[project] CHECK CONSTRAINT [FK_project_actItem]
GO
ALTER TABLE [dbo].[project]  WITH CHECK ADD  CONSTRAINT [FK_project_project_kind] FOREIGN KEY([kind])
REFERENCES [dbo].[project_kind] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[project] CHECK CONSTRAINT [FK_project_project_kind]
GO
ALTER TABLE [dbo].[project_sub]  WITH CHECK ADD  CONSTRAINT [FK_project_sub_project] FOREIGN KEY([pro_id])
REFERENCES [dbo].[project] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[project_sub] CHECK CONSTRAINT [FK_project_sub_project]
GO
ALTER TABLE [dbo].[Region]  WITH CHECK ADD  CONSTRAINT [FK_Region_ParentUuid] FOREIGN KEY([ParentUuid])
REFERENCES [dbo].[Region] ([Uuid])
GO
ALTER TABLE [dbo].[Region] CHECK CONSTRAINT [FK_Region_ParentUuid]
GO
ALTER TABLE [dbo].[Region]  WITH CHECK ADD  CONSTRAINT [FK_Region_RegionTypeUuid] FOREIGN KEY([RegionTypeUuid])
REFERENCES [dbo].[RegionType] ([Uuid])
GO
ALTER TABLE [dbo].[Region] CHECK CONSTRAINT [FK_Region_RegionTypeUuid]
GO
ALTER TABLE [dbo].[RegionAndRoomAndBedSchedule]  WITH CHECK ADD  CONSTRAINT [FK_Schedule_GuaDanOrderGuest] FOREIGN KEY([GuaDanOrderGuestUuid])
REFERENCES [dbo].[GuaDanOrderGuest] ([Uuid])
GO
ALTER TABLE [dbo].[RegionAndRoomAndBedSchedule] CHECK CONSTRAINT [FK_Schedule_GuaDanOrderGuest]
GO
ALTER TABLE [dbo].[RegionRoomBed]  WITH CHECK ADD  CONSTRAINT [FK_RegionRoomBed_RoomUuid] FOREIGN KEY([RoomUuid])
REFERENCES [dbo].[Room] ([Uuid])
GO
ALTER TABLE [dbo].[RegionRoomBed] CHECK CONSTRAINT [FK_RegionRoomBed_RoomUuid]
GO
ALTER TABLE [dbo].[RegionRoomBed]  WITH CHECK ADD  CONSTRAINT [FK_RegionRoomBed_StatusCode] FOREIGN KEY([StatusCode])
REFERENCES [dbo].[RegionRoomBedStatus] ([Code])
GO
ALTER TABLE [dbo].[RegionRoomBed] CHECK CONSTRAINT [FK_RegionRoomBed_StatusCode]
GO
ALTER TABLE [dbo].[Room]  WITH CHECK ADD  CONSTRAINT [FK_Room_Region] FOREIGN KEY([RegionUuid])
REFERENCES [dbo].[Region] ([Uuid])
GO
ALTER TABLE [dbo].[Room] CHECK CONSTRAINT [FK_Room_Region]
GO
ALTER TABLE [dbo].[stock]  WITH CHECK ADD  CONSTRAINT [FK_stock_actItem] FOREIGN KEY([actItem_num])
REFERENCES [dbo].[actItem] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[stock] CHECK CONSTRAINT [FK_stock_actItem]
GO
ALTER TABLE [dbo].[stock]  WITH CHECK ADD  CONSTRAINT [FK_stock_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[stock] CHECK CONSTRAINT [FK_stock_activity]
GO
ALTER TABLE [dbo].[stock]  WITH CHECK ADD  CONSTRAINT [FK_stock_member] FOREIGN KEY([mem_num])
REFERENCES [dbo].[member] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[stock] CHECK CONSTRAINT [FK_stock_member]
GO
ALTER TABLE [dbo].[stock]  WITH CHECK ADD  CONSTRAINT [FK_stock_stock_kind] FOREIGN KEY([kind])
REFERENCES [dbo].[stock_kind] ([num])
GO
ALTER TABLE [dbo].[stock] CHECK CONSTRAINT [FK_stock_stock_kind]
GO
ALTER TABLE [dbo].[stock]  WITH CHECK ADD  CONSTRAINT [FK_stock_stock_reason] FOREIGN KEY([reason])
REFERENCES [dbo].[stock_reason] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[stock] CHECK CONSTRAINT [FK_stock_stock_reason]
GO
ALTER TABLE [dbo].[stock]  WITH CHECK ADD  CONSTRAINT [FK_stock_supplier] FOREIGN KEY([supplier])
REFERENCES [dbo].[supplier] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[stock] CHECK CONSTRAINT [FK_stock_supplier]
GO
ALTER TABLE [dbo].[stock_files]  WITH CHECK ADD  CONSTRAINT [FK_stock_files_stock] FOREIGN KEY([stock_num])
REFERENCES [dbo].[stock] ([num])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[stock_files] CHECK CONSTRAINT [FK_stock_files_stock]
GO
ALTER TABLE [dbo].[supplier]  WITH CHECK ADD  CONSTRAINT [FK_supplier_supplier_kind] FOREIGN KEY([kind])
REFERENCES [dbo].[supplier_kind] ([num])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[supplier] CHECK CONSTRAINT [FK_supplier_supplier_kind]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_accounting_kind2] FOREIGN KEY([acc_num])
REFERENCES [dbo].[accounting_kind2] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_accounting_kind2]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_accountings] FOREIGN KEY([acc_kind])
REFERENCES [dbo].[accounting] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_accountings]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_actItem] FOREIGN KEY([balance_act_item])
REFERENCES [dbo].[actItem] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_actItem]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_activity] FOREIGN KEY([activity_num])
REFERENCES [dbo].[activity] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_activity]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_followers] FOREIGN KEY([f_num])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_followers]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_followers_match] FOREIGN KEY([f_num_match])
REFERENCES [dbo].[followers] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_followers_match]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_member] FOREIGN KEY([member_num])
REFERENCES [dbo].[member] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_member]
GO
ALTER TABLE [dbo].[transfer_register]  WITH CHECK ADD  CONSTRAINT [FK_transfer_register_pro_order_detail] FOREIGN KEY([balance_pro_order_detail])
REFERENCES [dbo].[pro_order_detail] ([num])
GO
ALTER TABLE [dbo].[transfer_register] CHECK CONSTRAINT [FK_transfer_register_pro_order_detail]
GO
/****** Object:  StoredProcedure [dbo].[pager_eztrust]    Script Date: 2025/9/15 01:12:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[pager_eztrust]
@StartRowIndex INT, @PageSize INT, @tableName NVARCHAR (3000), @columnName NVARCHAR (2000), @sqlWhere NVARCHAR (1000), @orderBy NVARCHAR (1000), @rowCount INT OUTPUT
WITH RECOMPILE
AS
DECLARE @sqlCount AS NVARCHAR (1000), @sqlDataTable AS NVARCHAR (3000), @LowerBand AS INT, @UpperBand AS INT;
SET @sqlCount = 'SELECT @rowCount=COUNT(*) FROM ' + @tableName + ' WHERE ' + @sqlWhere;
EXECUTE sp_executesql @sqlCount, N'@rowCount int output', @rowCount OUTPUT;
IF (@StartRowIndex = 0)
    BEGIN
        SET @LowerBand = 0;
        SET @UpperBand = @PageSize;
    END
ELSE
    BEGIN
        SET @LowerBand = @StartRowIndex + 1;
        SET @UpperBand = @StartRowIndex + @PageSize;
    END
SET @sqlDataTable = 'WITH tempTable AS
(SELECT ' + @columnName + ', ROW_NUMBER() OVER(ORDER BY ' + @orderBy + ') AS tempRowNum
FROM ' + @tableName + ' WHERE ' + @sqlWhere + ') 
SELECT * FROM tempTable WHERE tempRowNum BETWEEN ' + CAST (@LowerBand AS NVARCHAR) + ' AND ' + CAST (@UpperBand AS NVARCHAR) + ';';
EXECUTE (@sqlDataTable);
RETURN;

GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收支管理主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'accounting'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收支附件檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'accounting_files'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收支項目維護' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'accounting_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'收支帳戶維護' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'accounting_kind2'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'組合品項(功德主)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'act_bom'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品項管理主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'actItem'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品項相關文件檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'actItem_files'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'品項分類管理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'actItem_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活動主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'activity'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活動主類型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'activity_category_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活動報到檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'activity_check'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活動詳細分類' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'activity_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活動分類-相關品項' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'activity_kind_detail'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活動主檔-相關品項' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'activity_relating'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活動主檔-相關備品' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'activity_spares'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'使用者管理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'群組資料' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_group'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'登入記錄查詢' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'admin_log'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'(新)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'appellation'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'房間管理主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bed_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'房間管理-床位明細' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bed_kind_detail'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'報名-掛單主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bed_order'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'報名-掛單明細' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bed_order_detail'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'後台設定檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'company'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'國家列表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'country'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'家族成員資料' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'family_members'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'套表列印設定' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'files'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'信眾資料' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'followers'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'信眾牌位資料' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'followers_tablet'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'選項設定檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'item'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'人員主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'member'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'考勤' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'member_check'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'人員組別管理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'member_group'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'職稱管理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'member_title'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'公告資料主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'news'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'公告資料-附件檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'news_files'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'公告分類' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'news_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'縣市資料檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'PostCity'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'縣市-郵遞區號檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'PostNumber'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'報名主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'pro_order'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'報名明細檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'pro_order_detail'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'(新1)報名收款記錄' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'pro_order_record'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'專案管理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'project'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'專案類別管理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'project_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'專案管理-活動資料' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'project_sub'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'疏文資料表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ShuWen'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'庫存管理主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'stock'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'庫存管理-檔案附件' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'stock_files'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'倉庫資料主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'stock_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'庫存異動原因' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'stock_reason'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'(新3)供應商主檔' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'supplier'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'供應商類型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'supplier_kind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'匯款沖帳表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'transfer_register'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "pro_order_detail"
            Begin Extent = 
               Top = 9
               Left = 57
               Bottom = 196
               Right = 294
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "pro_order"
            Begin Extent = 
               Top = 9
               Left = 351
               Bottom = 196
               Right = 588
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "actItem"
            Begin Extent = 
               Top = 9
               Left = 645
               Bottom = 196
               Right = 882
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "activity"
            Begin Extent = 
               Top = 9
               Left = 939
               Bottom = 196
               Right = 1185
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "followers"
            Begin Extent = 
               Top = 9
               Left = 1242
               Bottom = 196
               Right = 1490
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
     ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'報名明細查詢'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'    Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'報名明細查詢'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'報名明細查詢'
GO

