SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Users](
	[UserID] [int] IDENTITY(1,1) NOT NULL,
	[UnionID] [int] NULL CONSTRAINT [DF_Users_UnionID_1]  DEFAULT ((0)),
	[Account] [varchar](50) NULL,
	[Email] [varchar](50) NULL,
	[Password] [varchar](32) NULL,
	[Status] [int] NULL CONSTRAINT [DF_Users_Status]  DEFAULT ((1)),
	[AuthenticationStatus] [int] NULL CONSTRAINT [DF_Users_AuthenticationStatus_1]  DEFAULT ((0)),
	[GroupID] [int] NULL CONSTRAINT [DF_Users_GroupID_1]  DEFAULT ((0)),
	[UserName] [nvarchar](20) NULL,
	[Sex] [int] NULL CONSTRAINT [DF_Users_Sex_1]  DEFAULT ((1)),
	[Picture] [varbinary](max) NULL,
	[CompanyName] [nvarchar](100) NULL,
	[Address] [nvarchar](100) NULL,
	[Tel] [varchar](100) NULL,
	[MobilePhone] [varchar](50) NULL,
	[Question] [nvarchar](50) NULL,
	[Answer] [nvarchar](50) NULL,
	[Source] [varchar](50) NULL,
	[LastLoginIP] [varchar](50) NULL,
	[LastLoginTime] [datetime] NULL CONSTRAINT [DF_Users_LastLoginTime_1]  DEFAULT (getdate()),
	[LoginIP] [varchar](50) NULL,
	[LoginTime] [datetime] NULL CONSTRAINT [DF_Users_LoginTime_1]  DEFAULT (getdate()),
	[Remark] [nvarchar](100) NULL,
	[Editor] [nvarchar](50) NULL,
	[UpdateTime] [datetime] NULL CONSTRAINT [DF_Users_UpdateTime_1]  DEFAULT (getdate()),
	[CreateTime] [datetime] NULL CONSTRAINT [DF_Users_CreateTime]  DEFAULT (getdate()),
	[Domain] [varchar](50) NULL,
 CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED 
(
	[UserID] 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
SET IDENTITY_INSERT [Users] ON 

INSERT [Users] ([UserID], [UnionID], [Account], [Email], [Password], [Status], [AuthenticationStatus], [GroupID], [UserName], [Sex], [Picture], [CompanyName], [Address], [Tel], [MobilePhone], [Question], [Answer], [Source], [LastLoginIP], [LastLoginTime], [LoginIP], [LoginTime], [Remark], [Editor], [UpdateTime], [CreateTime], [Domain]) VALUES (1, 0, N'test', N'1001@qq.com', N'E10ADC3949BA59ABBE56E057F20F883E', 1, 0, 0, N'李工', 1, NULL, NULL, N'北京', N'010-', N'135', N'你好', N'好', NULL, NULL, CAST(N'2014-12-12 23:47:56.140' AS DateTime), NULL, CAST(N'2014-12-12 23:47:56.140' AS DateTime), N'修改用户数据', NULL, CAST(N'2014-12-14 20:42:12.727' AS DateTime), CAST(N'2014-12-12 23:47:56.140' AS DateTime), NULL)
INSERT [Users] ([UserID], [UnionID], [Account], [Email], [Password], [Status], [AuthenticationStatus], [GroupID], [UserName], [Sex], [Picture], [CompanyName], [Address], [Tel], [MobilePhone], [Question], [Answer], [Source], [LastLoginIP], [LastLoginTime], [LoginIP], [LoginTime], [Remark], [Editor], [UpdateTime], [CreateTime], [Domain]) VALUES (2, 0, N'test2', N'', N'E10ADC3949BA59ABBE56E057F20F883E', 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'local', NULL, NULL, NULL, NULL, NULL, NULL, CAST(N'2015-01-02 18:03:33.317' AS DateTime), CAST(N'2015-01-02 18:03:33.317' AS DateTime), NULL)
INSERT [Users] ([UserID], [UnionID], [Account], [Email], [Password], [Status], [AuthenticationStatus], [GroupID], [UserName], [Sex], [Picture], [CompanyName], [Address], [Tel], [MobilePhone], [Question], [Answer], [Source], [LastLoginIP], [LastLoginTime], [LoginIP], [LoginTime], [Remark], [Editor], [UpdateTime], [CreateTime], [Domain]) VALUES (3, 0, N'test3', N'', N'E10ADC3949BA59ABBE56E057F20F883E', 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'local', NULL, NULL, NULL, NULL, NULL, NULL, CAST(N'2015-01-02 18:03:53.197' AS DateTime), CAST(N'2015-01-02 18:03:53.197' AS DateTime), NULL)
INSERT [Users] ([UserID], [UnionID], [Account], [Email], [Password], [Status], [AuthenticationStatus], [GroupID], [UserName], [Sex], [Picture], [CompanyName], [Address], [Tel], [MobilePhone], [Question], [Answer], [Source], [LastLoginIP], [LastLoginTime], [LoginIP], [LoginTime], [Remark], [Editor], [UpdateTime], [CreateTime], [Domain]) VALUES (4, 0, N'test4', N'', N'E10ADC3949BA59ABBE56E057F20F883E', 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'local', NULL, NULL, NULL, NULL, NULL, NULL, CAST(N'2015-01-02 18:06:48.550' AS DateTime), CAST(N'2015-01-02 18:06:48.550' AS DateTime), NULL)
SET IDENTITY_INSERT [Users] OFF
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户ID,表主键,自增长编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'UserID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'第三方用户登录ID或编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'UnionID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'账号,与邮箱互补也可二选一' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Account'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'邮箱账号,即登录账号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Email'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'登录密码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Password'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态:1有效(默认),0禁用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'验证状态:0未验证(默认),1邮箱验证,2手机验证,3邮箱和手机都进行了验证' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'AuthenticationStatus'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'分组编号,也可用来区分买家,卖家,个人,企业等' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'GroupID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'可选,用户姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'UserName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'可选,性别(1男(默认),2女)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Sex'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'图片/相片/logo/头像,类型暂定' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Picture'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'可选,企业名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'CompanyName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Address'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'联系电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Tel'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'移动电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'MobilePhone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'找回密码问题' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Question'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'找回密码问题答案' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Answer'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'可选,用户注册来源(如home前台注册)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Source'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上次登录IP' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'LastLoginIP'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上次登录时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'LastLoginTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本次登录IP' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'LoginIP'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'本次登录时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'LoginTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'可选,可存放网站编辑人员账号或姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Editor'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户信息最后更新时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'UpdateTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户注册时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'CreateTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'绑定域名,部分功能需要,比如商家黄页' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Domain'
GO
