📄 syposinit.sql
字号:
if exists (select 1
from sysobjects
where id = object_id('SubImportDetail')
and type = 'U')
drop table SubImportDetail
go
if exists (select 1
from sysobjects
where id = object_id('SubImport')
and type = 'U')
drop table SubImport
go
if exists (select 1
from sysobjects
where id = object_id('DelData')
and type = 'U')
drop table DelData
go
if exists (select 1
from sysobjects
where id = object_id('Batch')
and type = 'U')
drop table Batch
go
if exists (select 1
from sysobjects
where id = object_id('Checks')
and type = 'U')
drop table Checks
go
if exists (select 1
from sysobjects
where id = object_id('Paymode')
and type = 'U')
drop table Paymode
go
if exists (select 1
from sysobjects
where id = object_id('TopAndBottom')
and type = 'U')
drop table TopAndBottom
go
if exists (select 1
from sysobjects
where id = object_id('CustPrice')
and type = 'U')
drop table CustPrice
go
if exists (select 1
from sysobjects
where id = object_id('VendorPrice')
and type = 'U')
drop table VendorPrice
go
if exists (select 1
from sysobjects
where id = object_id('Req')
and type = 'U')
drop table Req
go
if exists (select 1
from sysobjects
where id = object_id('OrderDetail')
and type = 'U')
drop table OrderDetail
go
if exists (select 1
from sysobjects
where id = object_id('Orders')
and type = 'U')
drop table Orders
go
if exists (select 1
from sysobjects
where id = object_id('Cust')
and type = 'U')
drop table Cust
go
if exists (select 1
from sysobjects
where id = object_id('Vendor')
and type = 'U')
drop table Vendor
go
if exists (select 1
from sysobjects
where id = object_id('Staff')
and type = 'U')
drop table Staff
go
if exists (select 1
from sysobjects
where id = object_id('Goods')
and type = 'U')
drop table Goods
go
if exists (select 1
from sysobjects
where id = object_id('Class')
and type = 'U')
drop table Class
go
if exists (select 1
from sysobjects
where id = object_id('Team')
and type = 'U')
drop table Team
go
if exists (select 1
from sysobjects
where id = object_id('Dept')
and type = 'U')
drop table Dept
go
/* ============================================================ */
/* Table: Dept */
/* ============================================================ */
create table Dept
(
DeptNO TDEPT not null,
Name varchar(16) null ,
ShortName varchar(10) null ,
DeptType char(1) null ,
Manager varchar(10) null ,
MachineQty int null ,
LinkMan varchar(10) null ,
TaxNO Varchar(16) null ,
Acct Varchar(30) null ,
Bank varchar(16) null ,
Area NUMERIC(10,2) null ,
Tel VARCHAR(16) null ,
Addr VARCHAR(40) null ,
Zip VARCHAR(6) null ,
Fax VARCHAR(16) null ,
DeptKey VARCHAR(20) null ,
Property VARCHAR(20) null ,
MasterDept TDEPT null ,
LocalFlag char(1) not null
default '0',
ProfitRatio numeric(5,3) null
default 0.00,
constraint PK_DEPT primary key (DeptNO)
)
go
/* ============================================================ */
/* Table: Team */
/* ============================================================ */
create table Team
(
GroupNo TGROUP not null,
Name varchar(16) null ,
GroupType CHAR(1) not null
default '1',
ModifyDate TDATE not null
default GETDATE(),
constraint PK_TEAM primary key (GroupNo)
)
go
/* ============================================================ */
/* Table: Class */
/* ============================================================ */
create table Class
(
ClassNo TCLASS not null,
Name varchar(30) null ,
ModifyDate TDATE not null
default GETDATE(),
constraint PK_CLASS primary key (ClassNo)
)
go
/* ============================================================ */
/* Table: Goods */
/* ============================================================ */
create table Goods
(
GoodsNo TGOODS not null,
BarCode TGOODS not null,
UserDefNo varchar(13) null ,
Name varchar(30) not null,
ShortName varchar(16) null ,
GroupNo TGROUP not null,
ClassNo TCLASS not null,
RetailMode CHAR(1) null ,
ProductId varchar(15) null ,
RetailUnit varchar(8) null ,
PackUnit varchar(4) null ,
PackRatio NUMERIC(8,2) null ,
Vendorno TVendor not null
default '00000000',
Grade varchar(8) null ,
Model varchar(16) null ,
spec varchar(16) null ,
Color VARCHAR(16) null ,
Size VARCHAR(10) null ,
Operator TStaff null ,
TradeMark Varchar(20) null ,
RetailPrice TPRICE null ,
SalePrice TPRICE null ,
MemberPrice TPRICE null ,
EvaluatePrice TPRICE null ,
TaxRatio NUMERIC(5,3) null
default 0.17,
NEvaluatePrice TPRICE null ,
ProduceArea VARCHAR(30) null ,
StatNo VARCHAR(8) null ,
NewFlag Char(1) null ,
MustFlag Char(1) null ,
SPriceFlag Char(1) null
default '0',
Seasonflag Char(1) null ,
CategoryNo varchar(8) null ,
Producer TVendor null ,
InputDate TDATE null
default getdate(),
ModifyDate TDATE not null
default GETDATE(),
examinflag char(1) null ,
UseFlag Char(1) not null
default '1',
Area numeric(10,2) null ,
GoodsShelf Varchar(8) null ,
Points numeric(12,3) null ,
UD1 TUDF null ,
UD2 TUDF null ,
UD3 TUDF null ,
UD4 TUDF null ,
UD5 TUDF null ,
Remark TMEMO null ,
CostFlag char(1) null
default '0',
CostRatio numeric(8,3) null
default 0.00,
constraint PK_GOODS primary key (GoodsNo)
)
go
/* ============================================================ */
/* Table: Staff */
/* ============================================================ */
create table Staff
(
Operator TSTAFF not null,
Name VARCHAR(10) not null,
DeptNO TDEPT not null,
GroupNO TGROUP null ,
Sex CHAR(2) null ,
Nation VARCHAR(8) null ,
Grade tinyint not null,
Addr VARCHAR(40) null ,
Zip VARCHAR(6) null ,
Tel VARCHAR(16) null ,
Fax VARCHAR(16) null ,
WorkType CHAR(2) null ,
Birthday TDATE null ,
WorkDate TDATE null ,
EntryDate TDATE null ,
Education VARCHAR(8) null ,
Passwd VARCHAR(8) null
default '00000000',
PersonalId VARCHAR(18) null ,
Property VARCHAR(10) null ,
ModifyDate TDATE not null
default GETDATE(),
Remark VARCHAR(40) null ,
constraint PK_STAFF primary key (Operator)
)
go
/* ============================================================ */
/* Table: Vendor */
/* ============================================================ */
create table Vendor
(
VendorNo TVENDOR not null,
Name VARCHAR(40) null ,
ShortName VARCHAR(16) null ,
Tel VARCHAR(16) null ,
Fax VARCHAR(16) null ,
Zip VARCHAR(6) null ,
Addr VARCHAR(40) null ,
Scope Varchar(40) null ,
LegMan VARCHAR(10) null ,
Manager VARCHAR(10) null ,
LinkMan VARCHAR(10) null ,
Bank1 VARCHAR(30) null ,
Acct1 VARCHAR(30) null ,
Bank2 VARCHAR(30) null ,
Acct2 VARCHAR(30) null ,
TaxNO VARCHAR(16) null ,
PID VARCHAR(20) null ,
HID VARCHAR(20) null ,
PayMode TPAYMODE null ,
InputDate TDATE null
default GETDATE(),
ModifyDate TDATE not null
default GETDATE(),
UD1 TUDF null ,
UD2 TUDF null ,
UD3 TUDF null ,
UD4 TUDF null ,
UD5 TUDF null ,
Remark TMEMO null ,
AreaCode varchar(4) null ,
SeqNo varchar(8) null ,
constraint PK_VENDOR primary key (VendorNo)
)
go
/* ============================================================ */
/* Table: Cust */
/* ============================================================ */
create table Cust
(
CustNo TVENDOR not null,
Name VARCHAR(40) null ,
ShortName VARCHAR(16) null ,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -