数据库篇之[bsp_banners]数据表-网上商城BrnShop1.9升级至2.1升级说明(非官方版本)

asp.net(c#)网上商城BrnShop1.9升级至2.1升级说明(非官方版本)
主要描述在数据库方面进行升级(使用前请参照网上商城BrnShop1.9升级至2.1升级说明(非官方版本仅提供技术交流)的使用协议)

BrnShop1.9正式版本

/****** Object:  Table [dbo].[bsp_banners]    Script Date: 12/09/2014 14:07:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [bsp_banners](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[starttime] [datetime] NOT NULL,
	[endtime] [datetime] NOT NULL,
	[isshow] [tinyint] NOT NULL,
	[title] [nvarchar](100) NOT NULL,
	[img] [nvarchar](250) NOT NULL,
	[url] [nvarchar](250) NOT NULL,
	[displayorder] [int] NOT NULL,
 CONSTRAINT [PK_bsp_banners] 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
CREATE NONCLUSTERED INDEX [starttime_endtime_isshow] ON [bsp_banners] 
(
	[starttime] ASC,
	[endtime] ASC,
	[isshow] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'bannerid' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'starttime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'endtime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否展示' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'isshow'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'标题' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'title'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'图片' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'img'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'链接地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'url'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'displayorder'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'banner表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners'
GO
SET IDENTITY_INSERT [bsp_banners] ON
INSERT [bsp_banners] ([id], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (1, CAST(0x0000A35100B595F0 AS DateTime), CAST(0x0000A4D700B595F0 AS DateTime), 1, N'火爆促销', N'fr_1412061404492825858.jpg', N'/', 5)
INSERT [bsp_banners] ([id], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (4, CAST(0x0000A385017AA854 AS DateTime), CAST(0x0000A4D6017AA854 AS DateTime), 1, N'火爆促销', N'fr_1412061404419541666.jpg', N'/', 6)
INSERT [bsp_banners] ([id], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (5, CAST(0x0000A3EB0148AB74 AS DateTime), CAST(0x0000A5580148AB74 AS DateTime), 1, N'火爆促销', N'fr_1412061405306289506.jpg', N'/', 0)
INSERT [bsp_banners] ([id], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (6, CAST(0x0000A3EB0148CD70 AS DateTime), CAST(0x0000A5540148CD70 AS DateTime), 1, N'火爆促销', N'fr_1412061404554409380.jpg', N'/', 0)
SET IDENTITY_INSERT [bsp_banners] OFF


BrnShop2.1正式版本

/****** Object:  Table [dbo].[bsp_banners]    Script Date: 01/13/2015 10:11:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [bsp_banners](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[type] [tinyint] NOT NULL,
	[starttime] [datetime] NOT NULL,
	[endtime] [datetime] NOT NULL,
	[isshow] [tinyint] NOT NULL,
	[title] [nvarchar](100) NOT NULL,
	[img] [nvarchar](250) NOT NULL,
	[url] [nvarchar](250) NOT NULL,
	[displayorder] [int] NOT NULL,
 CONSTRAINT [PK_bsp_banners] 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
CREATE NONCLUSTERED INDEX [type_starttime_endtime_isshow] ON [bsp_banners] 
(
	[type] ASC,
	[starttime] ASC,
	[endtime] ASC,
	[isshow] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'bannerid' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类型(0代表PC,1代表手机)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'type'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'starttime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'endtime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否展示' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'isshow'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'标题' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'title'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'图片' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'img'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'链接地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'url'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'displayorder'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'banner表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners'
GO
SET IDENTITY_INSERT [bsp_banners] ON
INSERT [bsp_banners] ([id], [type], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (1, 0, CAST(0x0000A35100B595F0 AS DateTime), CAST(0x0000A4D700B595F0 AS DateTime), 1, N'火爆促销', N'fr_1412061404492825858.jpg', N'/', 5)
INSERT [bsp_banners] ([id], [type], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (4, 0, CAST(0x0000A385017AA854 AS DateTime), CAST(0x0000A4D6017AA854 AS DateTime), 1, N'火爆促销', N'fr_1412061404419541666.jpg', N'/', 6)
INSERT [bsp_banners] ([id], [type], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (5, 0, CAST(0x0000A3EB0148AB74 AS DateTime), CAST(0x0000A5580148AB74 AS DateTime), 1, N'火爆促销', N'fr_1412061405306289506.jpg', N'/', 0)
INSERT [bsp_banners] ([id], [type], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (6, 0, CAST(0x0000A3EB0148CD70 AS DateTime), CAST(0x0000A5540148CD70 AS DateTime), 1, N'火爆促销', N'fr_1412061404554409380.jpg', N'/', 0)
INSERT [bsp_banners] ([id], [type], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (7, 1, CAST(0x0000A40700AEA434 AS DateTime), CAST(0x0000A6E400AEA434 AS DateTime), 1, N'特大促销', N'fr_1412201036420464063.jpg', N'/', 0)
INSERT [bsp_banners] ([id], [type], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (8, 1, CAST(0x0000A40700AEEF34 AS DateTime), CAST(0x0000A6DD00AEEF34 AS DateTime), 1, N'特大促销', N'fr_1412201037096779867.jpg', N'/', 0)
INSERT [bsp_banners] ([id], [type], [starttime], [endtime], [isshow], [title], [img], [url], [displayorder]) VALUES (9, 1, CAST(0x0000A40700AF0B54 AS DateTime), CAST(0x0000A6E400AF0B54 AS DateTime), 1, N'特大促销', N'fr_1412201037338523694.jpg', N'/', 0)
SET IDENTITY_INSERT [bsp_banners] OFF

其中差异内容如图

差异内容有:

1.有[type]列

2.非聚合索引名称

3.执行增加扩展属性

4.数据插入

更新方法:

ALTER TABLE [bsp_banners]
  ADD [type] [tinyint]
  GO
  UPDATE [bsp_banners]
  SET [type] = 0	-- 默认为PC端
  GO
  ALTER TABLE [bsp_banners]
  ALTER COLUMN [type] [tinyint] NOT NULL	-- 
  GO
  CREATE NONCLUSTERED INDEX [type_starttime_endtime_isshow] ON [bsp_banners] 
(
	[type] ASC,
	[starttime] ASC,
	[endtime] ASC,
	[isshow] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类型(0代表PC,1代表手机)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'bsp_banners', @level2type=N'COLUMN',@level2name=N'type'


©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页