CREATE TABLE [BPIP_ATT](
	[ID] [varchar](20) NOT NULL,
	[FLOWID] [varchar](50)  NULL,
	[FORMID] [varchar](50)  NULL,
	[FILEID] [varchar](20)  NULL,
	[FILENAME] [varchar](200)  NULL,
	[FILESIZE] [numeric](18, 0) NULL,
	[FILEPATH] [varchar](200)  NULL,
	[FILEUSERNO] [varchar](16)  NULL,
	[ENTERDATE] [datetime] NULL,
	[AID] [varchar](50)  NULL,
        [YNAME] [varchar](200)  NULL
 CONSTRAINT [PK_BPIP_ATT] PRIMARY KEY CLUSTERED 
(
	[ID]
)
)


CREATE TABLE [BPIP_FIELD](
	[FIELDID] [varchar](8) NOT NULL,
	[TABLEID] [varchar](4)  NULL,
	[FIELDNAME] [varchar](30)  NULL,
	[FIELDTAG] [varchar](2)  NULL,
	[CHINESENAME] [varchar](60)  NULL,
	[FIELDTYPE] [varchar](1)  NULL,
	[FIELDLENGTH] [numeric](4, 0) NULL,
	[ISNULL] [varchar](1)  NULL,
	[DICTTABLE] [varchar](30)  NULL,
	[DESCRIPTION] [varchar](255)  NULL,
	[TAGEXT] [numeric](1, 0) NULL,
	[AUTO1] [varchar](8)  NULL,
	[AUTO2] [varchar](8)  NULL,
	[AUTO3] [varchar](8)  NULL,
	[BLOBSIZE] [numeric](8, 0) NULL,
	[QFIELD] [varchar](200)  NULL,
        [ISKEY] [varchar](1)  NULL
 CONSTRAINT [PK_BPIP_FIELD] PRIMARY KEY CLUSTERED 
(
	[FIELDID]
)
)


CREATE TABLE [BPIP_HANDSET](
	[ID] [varchar](20) NOT NULL,
	[USERNO] [varchar](16)  NULL,
	[MOBILE] [varchar](20)  NULL,
	[CONTENT] [varchar](500)  NULL,
	[SENDDATE] [datetime] NULL,
	[FINISHDATE] [datetime] NULL,
	[TYPEBOX] [numeric](1, 0) NULL,
	[SENDTYPE] [varchar](2)  NULL,
	[MONTH] [numeric](4, 0) NULL,
	[WEEK] [numeric](4, 0) NULL,
	[DAY] [numeric](4, 0) NULL,
	[HOUR] [numeric](4, 0) NULL,
	[MINUTE] [numeric](4, 0) NULL,
	[ISSEND] [char](1)  NULL,
	[TTABLEID] [varchar](50)  NULL,
	[SUSERNO] [varchar](16)  NULL
 CONSTRAINT [PK_BPIP_HANDSET] PRIMARY KEY CLUSTERED 
(
	[ID]
)
)


CREATE TABLE [BPIP_MENU](
	[MENUNO] [varchar](9) NOT NULL,
	[MENUNAME] [varchar](50)  NULL,
	[ISPOWER] [char](1)  NULL,
	[URL] [varchar](300)  NULL,
	[ISOPEN] [char](1)  NULL,
	[FLAG] [char](1)  NULL,
        [MNCODE] [varchar](9)  NULL
 CONSTRAINT [PK_BPIP_MENU] PRIMARY KEY CLUSTERED 
(
	[MENUNO]
)
)


CREATE TABLE [BPIP_MSGCONTENT](
	[CUSERNO] [varchar](16) NOT NULL,
	[CONTENT] [varchar](500)  NULL,
	[SENDDATE] [datetime] NULL,
	[ISCK] [varchar](1)  NULL
)


CREATE TABLE [BPIP_ROLE](
	[ROLEID] [numeric](10, 0) NOT NULL,
	[ROLENAME] [varchar](30) NULL,
	[DESCRIPTION] [varchar](100)  NULL
 CONSTRAINT [PK_BPIP_ROLE] PRIMARY KEY CLUSTERED 
(
	[ROLEID]
)
)

CREATE TABLE [BPIP_ROLE_RERMISSISSON](
	[ROLEID] [numeric](10, 0) NULL,
	[MENUNO] [varchar](9)  NULL
)



CREATE TABLE [BPIP_TABLE](
	[TABLEID] [varchar](4) NOT NULL,
	[TABLENAME] [varchar](30)  NULL,
	[CHINESENAME] [varchar](60)  NULL,
	[TABLESPACE] [varchar](30)  NULL,
	[DESCRIPTION] [varchar](255)  NULL,
	[TABLETYPE] [varchar](1)  NULL,
	[PRIMARYKEY] [varchar](30)  NULL,
	[TITLE] [varchar](30)  NULL
 CONSTRAINT [PK_BPIP_TABLE] PRIMARY KEY CLUSTERED 
(
	[TABLEID]
)
)


CREATE TABLE [BPIP_TABLESPACE](
	[ID] [varchar](2) NOT NULL,
	[CHINESENAME] [varchar](60)  NULL,
	[DESCRIPTION] [varchar](255)  NULL,
        [DTABLE] [varchar](200)  NULL
 CONSTRAINT [PK_BPIP_TABLESPACE] PRIMARY KEY CLUSTERED 
(
	[ID]
)
)


CREATE TABLE [BPIP_UNIT](
	[UNITID] [varchar](12) NOT NULL,
	[UNITNAME] [varchar](100)  NULL,
	[STATE] [varchar](1)  NULL,
	[ORDERCODE] [varchar](4)  NULL
 CONSTRAINT [PK_BPIP_UNIT] PRIMARY KEY CLUSTERED 
(
	[UNITID]
)
)



CREATE TABLE [BPIP_USER](
	[USERID] [varchar](16) NOT NULL,
	[LOGINID] [varchar](20)  NULL,
	[LOGINPW] [varchar](32)  NULL,
	[USERSTATE] [varchar](1)  NULL,
	[NAME] [varchar](30)  NULL,
	[LCODE] [varchar](6)  NULL,
	[UNITID] [varchar](12)  NULL,
	[SEX] [varchar](1)  NULL,
	[BIRTHDAY] [datetime] NULL,
	[PHONE] [varchar](30)  NULL,
	[MOBILE] [varchar](100)  NULL,
	[EMAIL] [varchar](50)  NULL,
	[USERIMAGE] [varchar](3)  NULL,
	[LOGINTIME] [numeric](10, 0) NULL,
	[PAGESIZE] [numeric](3, 0) NULL,
	[WINDOWTYPE] [varchar](1)  NULL,
	[DEPTINSIDE] [char](1)  NULL,
	[ORBERCODE] [varchar](6)  NULL,
	[ONLINEDATE] [datetime] NULL
 CONSTRAINT [PK_BPIP_USER] PRIMARY KEY CLUSTERED 
(
	[USERID]
)
)


CREATE TABLE [BPIP_USER_IDEA](
	[ID] [varchar](8) NOT NULL,
	[USER_NO] [varchar](16)  NULL,
	[CONTENT] [varchar](200)  NULL
 CONSTRAINT [PK_BPIP_USER_IDEA] PRIMARY KEY CLUSTERED 
(
	[ID]
)
)


CREATE TABLE [BPIP_USER_PHOTO](
	[USERID] [varchar](16) NOT NULL,
	[USERPHOTO] [image] NULL,
	[USERIMAGE] [varchar](3)  NULL,
	[IDIOGRAPH] [image] NULL
 CONSTRAINT [PK_BPIP_USER_PHOTO] PRIMARY KEY CLUSTERED 
(
	[USERID]
)
)


CREATE TABLE [BPIP_USER_REMOVE](
	[ID] [numeric](10, 0) NOT NULL,
	[MOVETIME] [datetime] NULL,
	[USERID] [varchar](16)  NULL,
	[BEFOREUNIT] [varchar](100)  NULL,
	[AFTERUNIT] [varchar](100)  NULL,
	[MOVEREASON] [varchar](255)  NULL
 CONSTRAINT [PK_BPIP_USER_REMOVE] PRIMARY KEY CLUSTERED 
(
	[ID]
)
)


CREATE TABLE [BPIP_USER_ROLE](
	[USERID] [varchar](16)  NULL,
	[ROLEID] [numeric](38, 0) NULL,
	[UNITID] [varchar](12)  NULL
)


