脚本如下:
USE [AdventureWorks]
GO
/****** Object: Table [dbo].[Table_1] Script Date: 2012/11/3 3:13:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Table_1](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[类别名称] [varchar](50) NULL,
[方式] [varchar](50) NULL,
[名称] [varchar](50) NULL,
[值] [varchar](50) NULL,
CONSTRAINT [PK_Table_1] 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
SET ANSI_PADDING ON
GO
/****** Object: Table [dbo].[Table_2] Script Date: 2012/11/3 3:13:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Table_2](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[Table_1_ID] [bigint] NULL,
[Property] [varchar](50) NULL,
CONSTRAINT [PK_Table_2] 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
SET ANSI_PADDING ON
GO
/****** Object: Table [dbo].[Table_3] Script Date: 2012/11/3 3:13:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Table_3](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[产品名称] [varchar](50) NULL,
[类别] [varchar](50) NULL,
CONSTRAINT [PK_Table_3] 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
SET ANSI_PADDING ON
GO
SET IDENTITY_INSERT [dbo].[Table_1] ON
INSERT [dbo].[Table_1] ([id], [类别名称], [方式], [名称], [值]) VALUES (1, N'食品', N'文本', N'生产日期', N'2012-10-01')
INSERT [dbo].[Table_1] ([id], [类别名称], [方式], [名称], [值]) VALUES (2, N'食品', N'选择', N'状态', N'1')
INSERT [dbo].[Table_1] ([id], [类别名称], [方式], [名称], [值]) VALUES (3, N'食品', N'文本', N'保质期', N'90')
INSERT [dbo].[Table_1] ([id], [类别名称], [方式], [名称], [值]) VALUES (4, N'电器', N'选择', N'状态', N'3')
INSERT [dbo].[Table_1] ([id], [类别名称], [方式], [名称], [值]) VALUES (5, N'电器', N'文本', N'出厂日期', N'2012-09-05')
SET IDENTITY_INSERT [dbo].[Table_1] OFF
SET IDENTITY_INSERT [dbo].[Table_2] ON