if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AREA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[AREA]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MessageMirror]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MessageMirror]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OfflineFiles]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[OfflineFiles]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OfflineInfo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[OfflineInfo]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OrgReg]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[OrgReg]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OrgRegLogIn]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[OrgRegLogIn]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RoomMember]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[RoomMember]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RoomOutcast]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[RoomOutcast]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RoomRequest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[RoomRequest]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[authreg]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[authreg]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[motd-message]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[motd-message]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[occupationtype]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[occupationtype]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[organize]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[organize]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[orguser]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[orguser]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[producttype]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[producttype]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[queue]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[queue]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[right]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[right]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[roleright]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[roleright]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[room]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[room]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[roommsg]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[roommsg]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[rostergroups]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[rostergroups]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[rosteritems]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[rosteritems]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[service]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[service]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usertype]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[usertype]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usertyperight]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[usertyperight]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[vcard]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[vcard]
GO

CREATE TABLE [dbo].[AREA] (
	[SERIALNO] [int] NOT NULL ,
	[SNAME] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FSERIALNO] [int] NULL ,
	[LEVELTYPE] [int] NULL ,
	[POSTCODE] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[AREANUM] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TMPPOSTCODE] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TMPAREANUM] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[PINYIN] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[MessageMirror] (
	[MessageID] [int] IDENTITY (1, 1) NOT NULL ,
	[SendUserNo] [int] NULL ,
	[RecieveUserNo] [int] NULL ,
	[SendUserID] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[RecieveUserID] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Message] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[UmFlag] [int] NOT NULL ,
	[NoteFlag] [int] NULL ,
	[SubmitTime] [datetime] NULL ,
	[UmSendTime] [datetime] NULL ,
	[NoteSendTime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[OfflineFiles] (
	[sFromID] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sToID] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sFileName] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sPath] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[srealfilename] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[sSize] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[sType] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[sTime] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[sSendOk] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[OfflineInfo] (
	[FromUser] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ToUser] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[SendTime] [datetime] NULL ,
	[SendContent] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[FromRealm] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[ToRealm] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[OrgReg] (
	[orgid] [int] IDENTITY (1, 1) NOT NULL ,
	[orgname] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[orghdid] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[orgkey] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[orggmdate] [datetime] NULL ,
	[lastdate] [datetime] NULL ,
	[yxdate] [datetime] NULL ,
	[regtype] [int] NULL ,
	[orgurl] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[orgnum] [int] NULL ,
	[serviceId] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[orgaddr] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[orgpost] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[orgtel] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[linkman] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[mobile] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[email] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[fax] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[regstatus] [int] NULL ,
	[active] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[OrgRegLogIn] (
	[orgid] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[orghdid] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[orgkey] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[lastdate] [datetime] NULL ,
	[orgnum] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[onlinenum] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[dayusernum] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[RoomMember] (
	[MemberId] [int] IDENTITY (1, 1) NOT NULL ,
	[RoomName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Nick] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[jid] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[status] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[show] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[blockShow] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[role] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[affiliation] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[adddatetime] [datetime] NULL ,
	[lastdatetime] [datetime] NULL ,
	[membertype] [int] NULL ,
	[RoomClass] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[RoomOutcast] (
	[OutcastId] [int] IDENTITY (1, 1) NOT NULL ,
	[RoomName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[jid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[reason] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[RoomRequest] (
	[RequestId] [int] IDENTITY (1, 1) NOT NULL ,
	[RoomName] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[itype] [int] NULL ,
	[Tojid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[fromjid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sxml] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[bz] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[authreg] (
	[username] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[realm] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[password] [varchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[USERID] [int] NULL ,
	[serialNo] [int] NULL ,
	[companyID] [int] NULL ,
	[token] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sequence] [int] NULL ,
	[hash] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[nickname] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[organizeNo] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[usertype] [int] NOT NULL ,
	[userrole] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[regDate] [datetime] NULL ,
	[lastdate] [datetime] NULL ,
	[loginnum] [int] NULL ,
	[mind] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sstatus] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[sshow] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[spriority] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[istatus] [int] NULL  Default 0
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[motd-message] (
	[object-sequence] [int] IDENTITY (1, 1) NOT NULL ,
	[collection-owner] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[xml] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[occupationtype] (
	[clsname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[tag] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[organize] (
	[organizeNo] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[organizename] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[parNo] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[orgorder] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[orguser] (
	[userid] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[orgid] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[producttype] (
	[clsname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[tag] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[queue] (
	[object-sequence] [int] IDENTITY (1, 1) NOT NULL ,
	[collection-owner] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[xml] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Message] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[sid] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfrom] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[sto] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[senddatetime] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[right] (
	[rightno] [int] NOT NULL ,
	[rightName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[roleright] (
	[orgno] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[roleno] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[userrole] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[rightName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[datatype] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [room] (
	[roomid] [int] IDENTITY (1, 1) NOT NULL ,
	[roomname] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ServerName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[RealRoomName] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[RoomCaption] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[RoomSubject] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[persistentroom] [bit] NOT NULL DEFAULT (0),
	[publicroom] [bit] NOT NULL DEFAULT (0),
	[publiclist] [bit] NOT NULL DEFAULT (0),
	[passwordprotectedroom] [bit] NOT NULL DEFAULT (0),
	[roomsecret] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[maxusers] [int] NULL ,
	[whois] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[membersonly] [bit] NOT NULL ,
	[moderatedroom] [bit] NOT NULL ,
	[membersbydefault] [bit] NOT NULL ,
	[changesubject] [bit] NOT NULL ,
	[allowFprivatemessages] [bit] NOT NULL ,
	[allowqueryusers] [bit] NOT NULL ,
	[allowinvites] [bit] NOT NULL CONSTRAINT [DF_room_allowinvites] DEFAULT (0),
	[RoomType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[CreateUser] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Status] [int] NULL ,
	[Priority] [int] NULL ,
	[RoomClass] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[roommsg] (
	[MsgId] [int] IDENTITY (1, 1) NOT NULL ,
	[RoomName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[sMsgXml] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[sSendMember] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[sFrom] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sMsg] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[dSendDate] [datetime] NULL ,
	[sId] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[rostergroups] (
	[objectsequence] [int] IDENTITY (1, 1) NOT NULL ,
	[collectionowner] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[jid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[group] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[rosteritems] (
	[objectsequence] [int] IDENTITY (1, 1) NOT NULL ,
	[collectionowner] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[jid] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[to] [int] NULL ,
	[from] [smallint] NULL ,
	[ask] [smallint] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[service] (
	[serviceid] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[servicename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[servicegmdate] [datetime] NULL ,
	[servicetype] [int] NULL ,
	[serviceurl] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[serviceaddr] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[servicepost] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[servicetel] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[linkman] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[mobile] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[email] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[regstatus] [int] NULL ,
	[active] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[usertype] (
	[orgno] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[usertypeno] [int] NULL ,
	[usertypename] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[datatype] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[usertyperight] (
	[usertypeno] [int] NULL ,
	[righttypeno] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[vcard] (
	[object_sequence] [int] IDENTITY (1, 1) NOT NULL ,
	[collection_owner] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[username] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[nickname] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[fn] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[url] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[tel] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[email] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[title] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[role] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[bday] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[self_desc] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[n_given] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[n_family] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[adr_street] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[adr_extadd] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[adr_locality] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[adr_region] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[adr_pcode] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[adr_country] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[org_orgname] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[org_orgunit] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[organizeNo] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[work_tel] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[mobilephone] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[work_adr] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sex] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[work_fax] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Business] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sXml] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[industry] [varchar] (60) COLLATE Chinese_PRC_CI_AS NULL ,
	[area_1] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[area_2] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[area_3] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[umsysinfo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[umsysinfo]
GO
CREATE TABLE [dbo].[umsysinfo] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[itype] [int] NULL ,
	[sname] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[slable] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sbz] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ftpfile]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ftpfile]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ftpfileall]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ftpfileall]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ftpfilegroup]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ftpfilegroup]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ftpfileorg]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ftpfileorg]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ftpfileorglist]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ftpfileorglist]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ftpfileuser]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ftpfileuser]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ftpfileversion]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ftpfileversion]
GO

CREATE TABLE [dbo].[ftpfile] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[sfilename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfileip] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[srealname] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[filepath] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ifilesize] [int] NULL ,
	[ssendid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssendnick] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[itype] [int] NULL ,
	[irighttype] [int] NULL ,
	[ssenddate] [datetime] NULL ,
	[sfilememo] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfiletype] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[igetnum] [int] NULL ,
	[ifilevalue] [int] NULL ,
	[itotalfilevalue] [int] NULL ,
	[ifileversion] [int] NULL ,
	[istatus] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ftpfileall] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[sfilename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfileip] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[srealname] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ifilesize] [int] NULL ,
	[ssendid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssendnick] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssenddate] [datetime] NULL ,
	[sfilememo] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfiletype] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[igetnum] [int] NULL ,
	[ifilevalue] [int] NULL ,
	[itotalfilevalue] [int] NULL ,
	[ifileversion] [int] NULL ,
	[istatus] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ftpfilegroup] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[sfilename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfileip] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[srealname] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ifilesize] [int] NULL ,
	[ssendid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssendnick] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sgroupid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssenddate] [datetime] NULL ,
	[sfilememo] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfiletype] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[igetnum] [int] NULL ,
	[ifileversion] [int] NULL ,
	[istatus] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ftpfileorg] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[sfilename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfileip] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[srealname] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ifilesize] [int] NULL ,
	[ssendid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssendnick] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sorgid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssenddate] [datetime] NULL ,
	[sfilememo] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfiletype] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[igetnum] [int] NULL ,
	[ifileversion] [int] NULL ,
	[istatus] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ftpfileorglist] (
	[sfilename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssendid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sorgid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[itype] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ftpfileuser] (
	[sfilename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ssendid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[suserid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[itype] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ftpfileversion] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[ssendid] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfilename] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[srealname] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ifilesize] [int] NULL ,
	[sfileversion] [varchar] (4) COLLATE Chinese_PRC_CI_AS NULL ,
	[itype] [int] NULL 
) ON [PRIMARY]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[IPTABLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[IPTABLE]
GO

CREATE TABLE [dbo].[IPTABLE] (
	[ID] [int] NOT NULL ,
	[StartIPNum] [money] NOT NULL ,
	[StartIPText] [nvarchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
	[EndIPNum] [money] NOT NULL ,
	[EndIPText] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Country] [varchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Local] [varchar] (255) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

exec sp_addextendedproperty N'MS_Description', N'分值', N'user', N'dbo', N'table', N'ftpfile', N'column', N'ifilevalue'
GO
exec sp_addextendedproperty N'MS_Description', N'版本', N'user', N'dbo', N'table', N'ftpfile', N'column', N'ifileversion'
GO
exec sp_addextendedproperty N'MS_Description', N'下载次数', N'user', N'dbo', N'table', N'ftpfile', N'column', N'igetnum'
GO
exec sp_addextendedproperty N'MS_Description', N'文件权限类型0：全部；1：自己2：指定用户', N'user', N'dbo', N'table', N'ftpfile', N'column', N'irighttype'
GO
exec sp_addextendedproperty N'MS_Description', N'状态0：开始1：完成', N'user', N'dbo', N'table', N'ftpfile', N'column', N'istatus'
GO
exec sp_addextendedproperty N'MS_Description', N'已下载的分值', N'user', N'dbo', N'table', N'ftpfile', N'column', N'itotalfilevalue'
GO
exec sp_addextendedproperty N'MS_Description', N'文件共享类型1：本地；0：服务器', N'user', N'dbo', N'table', N'ftpfile', N'column', N'itype'
GO
exec sp_addextendedproperty N'MS_Description', N'文件类别（自定义）', N'user', N'dbo', N'table', N'ftpfile', N'column', N'sfiletype'
GO
exec sp_addextendedproperty N'MS_Description', N'分值', N'user', N'dbo', N'table', N'ftpfileall', N'column', N'ifilevalue'
GO
exec sp_addextendedproperty N'MS_Description', N'版本', N'user', N'dbo', N'table', N'ftpfileall', N'column', N'ifileversion'
GO
exec sp_addextendedproperty N'MS_Description', N'下载次数', N'user', N'dbo', N'table', N'ftpfileall', N'column', N'igetnum'
GO
exec sp_addextendedproperty N'MS_Description', N'状态0：开始1：完成', N'user', N'dbo', N'table', N'ftpfileall', N'column', N'istatus'
GO
exec sp_addextendedproperty N'MS_Description', N'已下载的分值', N'user', N'dbo', N'table', N'ftpfileall', N'column', N'itotalfilevalue'
GO
exec sp_addextendedproperty N'MS_Description', N'文件类别（自定义）', N'user', N'dbo', N'table', N'ftpfileall', N'column', N'sfiletype'
GO
exec sp_addextendedproperty N'MS_Description', N'版本', N'user', N'dbo', N'table', N'ftpfilegroup', N'column', N'ifileversion'
GO
exec sp_addextendedproperty N'MS_Description', N'下载次数', N'user', N'dbo', N'table', N'ftpfilegroup', N'column', N'igetnum'
GO
exec sp_addextendedproperty N'MS_Description', N'状态0：开始1：完成', N'user', N'dbo', N'table', N'ftpfilegroup', N'column', N'istatus'
GO
exec sp_addextendedproperty N'MS_Description', N'文件类别（自定义）', N'user', N'dbo', N'table', N'ftpfilegroup', N'column', N'sfiletype'
GO
exec sp_addextendedproperty N'MS_Description', N'版本', N'user', N'dbo', N'table', N'ftpfileorg', N'column', N'ifileversion'
GO
exec sp_addextendedproperty N'MS_Description', N'下载次数', N'user', N'dbo', N'table', N'ftpfileorg', N'column', N'igetnum'
GO
exec sp_addextendedproperty N'MS_Description', N'状态0：开始1：完成', N'user', N'dbo', N'table', N'ftpfileorg', N'column', N'istatus'
GO
exec sp_addextendedproperty N'MS_Description', N'文件类别（自定义）', N'user', N'dbo', N'table', N'ftpfileorg', N'column', N'sfiletype'
GO
exec sp_addextendedproperty N'MS_Description', N'类型1：个人，2：组群，3：全部,4:组织', N'user', N'dbo', N'table', N'ftpfileversion', N'column', N'itype'
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MessageLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MessageLog]
GO

CREATE TABLE [dbo].[MessageLog] (
	[COLLECTION-OWNER] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[xml] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[message] [varchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[sid] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sfrom] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[sto] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[senddate] [datetime] NULL ,
	[sendip] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO
alter table organize add [url] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL;
GO
alter table organize add [email] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ;
GO
alter table organize add [worktel] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ;
GO
alter table organize add [workadr] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ;
GO
alter table organize add [industry] [varchar] (60) COLLATE Chinese_PRC_CI_AS NULL;
GO
alter table organize add [username] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ;
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DnsServer]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[DnsServer]
GO

CREATE TABLE [dbo].[DnsServer] (
	[username] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[psword] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[usertype] [int] NULL ,
	[dnsname] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[dnsip] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[regdate] [datetime] NULL ,
	[lastdate] [datetime] NULL ,
	[istatus] [int] NULL 
) ON [PRIMARY]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[statistic]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[statistic]
GO

CREATE TABLE [dbo].[statistic] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[sresource] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[sreferrer] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[surl] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[skeyword] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[sappName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[sappCodeName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[sappVersion] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[splatform] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[slanguage] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[logindate] [datetime] NULL ,
	[sip] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[iip] [float] NULL ,
	[sOrgid] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[sCountry] [varchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[sLocal] [varchar] (255) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tSysClassDict]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tSysClassDict]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tSysClassPropDict]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tSysClassPropDict]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tSysEnumType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tSysEnumType]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tSysEnumValue]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tSysEnumValue]
GO

CREATE TABLE [dbo].[tSysClassDict] (
	[ClassID] [numeric](5, 0) NOT NULL ,
	[ClassName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DatasetName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[JkClassType] [varchar] (1) COLLATE Chinese_PRC_CI_AS NULL ,
	[JkDatasetName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[JkMemo] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[tSysClassPropDict] (
	[ClassID] [numeric](5, 0) NOT NULL ,
	[DatasetName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PropID] [numeric](5, 0) NOT NULL ,
	[PropName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[FieldName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[JkDatasetName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[JkFieldName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[JkPropType] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[JkDataWidth] [numeric](5, 0) NULL ,
	[JkJoin] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[encrypt] [bit] NULL ,
	[encryptType] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[encryptPass] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[encryptDll] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[encryptFunction] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[tSysEnumType] (
	[LangID] [numeric](5, 0) NOT NULL ,
	[EnumTypeID] [numeric](5, 0) NOT NULL ,
	[EnumTypeName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[VerNo] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[tSysEnumValue] (
	[LangID] [numeric](5, 0) NOT NULL ,
	[EnumTypeID] [numeric](5, 0) NOT NULL ,
	[EnumValueID] [varchar] (4) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[EnumValueName] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsDefault] [varchar] (1) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispIndex] [numeric](5, 0) NOT NULL ,
	[VerNo] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO
alter table organize add [yxdate] [datetime] NULL
GO
alter table organize add [usernum] [int] NULL
GO
alter table organize add [stype] [int] NULL
GO
alter table organize add [righttype] [int] NULL
GO

CREATE TABLE [orgright] (
	[rightno] [int] NOT NULL ,
	[rightName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_orgright] PRIMARY KEY  CLUSTERED 
	(
		[rightno]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO


CREATE TABLE [Orgrightlist] (
	[righttype] [int] NOT NULL ,
	[rightname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[rightno] [int] NOT NULL ,
	CONSTRAINT [PK_Orgrightlist] PRIMARY KEY  CLUSTERED 
	(
		[righttype],
		[rightno]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[appraise]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[appraise]
GO

CREATE TABLE [dbo].[appraise] (
	[sappraise] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[susername] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[slevel] [int] NULL ,
	[scontent] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[appraisedate] [datetime] NULL ,
	[orgid] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO
insert into umsysinfo (itype, sname, slable) values (0,'3.0.0.100902','数据库版本')
GO
alter table orgreg add ipname varchar(100) null
GO
alter table orgreg add isok int null
GO
insert into orgright (rightno,rightname) values (1,'基本客服')
GO
insert into orgright (rightno,rightname) values (2,'客服管理')
GO
insert into orgright (rightno,rightname) values (3,'统计分析')
GO
insert into orgright (rightno,rightname) values (4,'扩展功能')
GO
insert into orgright (rightno,rightname) values (5,'增值功能')
GO
insert into orgrightlist (righttype,rightname,rightno) values (1,'基本功能',1)
GO
insert into orgrightlist (righttype,rightname,rightno) values (1,'基本功能',2)
GO
insert into orgrightlist (righttype,rightname,rightno) values (2,'扩展功能',1)
GO
insert into orgrightlist (righttype,rightname,rightno) values (2,'扩展功能',2)
GO
insert into orgrightlist (righttype,rightname,rightno) values (2,'扩展功能',3)
GO
insert into orgrightlist (righttype,rightname,rightno) values (2,'扩展功能',4)
GO

insert into roleright (orgno, roleno, userrole, rightName, datatype) values ('001','1','部门经理','1101000000000000',1)
GO
insert into roleright (orgno, roleno, userrole, rightName, datatype) values ('001','2','服务员','1110100000000000',1)
GO
insert into roleright (orgno, roleno, userrole, rightName, datatype) values ('001','3','员工','1000000000000000',0)
GO
insert into roleright (orgno, roleno, userrole, rightName, datatype) values ('Root','6','经理','1100110000000100',0)
GO

insert into organize (organizeNo,organizename,orgOrder) values ('001','联信UM虚拟有限公司','1')
GO

INSERT INTO producttype (clsname) VALUES ('电子')
GO
INSERT INTO producttype (clsname) VALUES ('纺织')
GO
INSERT INTO producttype (clsname) VALUES ('服务')
GO
INSERT INTO producttype (clsname) VALUES ('化工')
GO
INSERT INTO producttype (clsname) VALUES ('机械')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('0','文件')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('1','文件夹')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('2','语音')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('3','视频')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('4','协助')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('5','控制')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('6','建群(会议室)')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('7','加入群(会议室)')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('8','群发消息')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('9','删除好友')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('10','添加联系人')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('11','个人信息修改')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('12','组织内通讯')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('13','组织外通讯')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('14','插件')
GO
INSERT INTO [RIGHT] (rightno,rightName) VALUES ('15','升级')
GO

INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','00','默认角色','1111111111111111',1)
GO
INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','01','员工','1111111111111111',0)
GO
INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','02','经理','1111111111111111',0)
GO
INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','03','领导','1111111111111111',0)
GO
INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','04','客服','1111111111111111',0)
GO
INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','05','用户','0000000000000000',0)
GO
INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','06','供应商','0000000000000000',0)
GO
INSERT INTO ROLERIGHT (orgno,roleno,userrole,rightName,datatype) VALUES ('001','07','客户','1100000000000000',0)
GO

INSERT INTO USERTYPE (orgno,usertypeno,usertypename,datatype) VALUES ('001','0','组织用户',1)
GO
INSERT INTO USERTYPE (orgno,usertypeno,usertypename,datatype) VALUES ('001','1','注册用户',1)
GO
INSERT INTO USERTYPE (orgno,usertypeno,usertypename,datatype) VALUES ('001','2','管理员',1)
GO
INSERT INTO USERTYPE (orgno,usertypeno,usertypename,datatype) VALUES ('001','3','客服人员',0)
GO
INSERT INTO USERTYPE (orgno,usertypeno,usertypename,datatype) VALUES ('001','4','用户',0)
GO
INSERT INTO USERTYPE (orgno,usertypeno,usertypename,datatype) VALUES ('001','5','供应商',0)
GO
INSERT INTO USERTYPE (orgno,usertypeno,usertypename,datatype) VALUES ('001','6','客户',0)
GO

INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (3,2)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (3,3)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (3,4)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (1,2)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (0,2)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (0,0)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (2,6)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (2,5)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (2,4)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (2,2)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (2,0)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (2,1)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (6,6)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (5,5)
GO
INSERT INTO USERTYPERIGHT (usertypeno,righttypeno) VALUES (4,4)
GO