
 CREATE TABLE Btype(FLCode varchar(40),FLGroup varchar(40),YN bit NULL,PaiLie int NULL,DW0 varchar(40),DW1 varchar(40),DW2 varchar(40),DW3 varchar(40),DW4 varchar(40),DW5 varchar(40),DW6 varchar(40),DW7 varchar(40),DW8 varchar(40),DW9 varchar(40),PinYin varchar(40),Total numeric(18, 4) NULL)

 CREATE TABLE BarCode(Code int IDENTITY (1, 1) NOT NULL,emp_no varchar(40) NULL,ddate datetime NULL,BarCode varchar (40) NULL) 

 CREATE TABLE CaZuLog(Code bigint IDENTITY(1,1) NOT NULL,CaZuName varchar(40),CoPuName varchar(40),HeadName varchar(40),BillName varchar(40),Val1 varchar(100),Val2 varchar(100),Val3 varchar(100),Val4 varchar(100),Val5 varchar(100),Val6 varchar(100),SQLDateTime datetime NULL)

 Create Table ChiMa (Code int null,FullName varchar(40) null)

 Create Table ChiMaTMP (ChiMa varchar(12) null,Row int null)
 
 CREATE TABLE ClientBFHF(Code int NULL,BFHF varchar(40) NULL,FileName varchar(50) NULL ,TiShi varchar(40) NULL,YaSuoFile image NULL)
 
 Create Table CodeTable(FieldName varchar(8) null,InputCode varchar(6) null,Code varchar(128) null)  
 Insert into  CodeTable(FieldName,InputCode,Code)VALUES ('JOB','1','平车')  
 Insert into  CodeTable(FieldName,InputCode,Code)VALUES ('JOB','1','钑车') 
 Insert into  CodeTable(FieldName,InputCode,Code)VALUES ('JOB','1','冚车') 
          
 Create Table Color (Code int null,FullName varchar(40) null)
 Create Table CONF (Configured varchar(100) null,TiaoMaHead varchar(40) null)

 Insert into  CONF (Configured,TiaoMaHead)VALUES('0000001000201311000000020140101000000000000000000000000000000000000000000000000000000000000000000000','1000')

 Create Table dangyuerenwu(jiner numeric(18,4) null)   
 
 Create Table DelGongHao (DelGongHao varchar(10) null,DelName varchar(10) null,DelDateTime datetime null,SaveGongHao varchar(10) null)

 Create Table Department(DEPT_NO smallint not null primary key,DEPT_NAME varchar(50) null,HEAD_DEPT smallint null,LOCATION smallint null )    
 Insert into  Department(DEPT_NO,DEPT_NAME,HEAD_DEPT,LOCATION)VALUES ('1','办公室','-1','0')  

 Create Table DINGDAN(DingDanHao varchar(20) not null primary key,KuanHao varchar(20) null,GongXuLiang smallint null,XiaDanRiQi datetime null,KaiShiRiQi datetime null,JieShuRiQi datetime null,KaiShiTiaoMa int null,JieShuTiaoMa int null, BeiZhu varchar(255) null,ZhiYang varchar(20) null,KeKuan varchar(20) null,KeHu varchar(30) null,BuZhong varchar(20) null,DingDanShu int null,KuanShi varchar(40) null,ShouDanRiQi datetime null,LuoHuoRiQi datetime null,WanCheng bit null,HeDingRiQi datetime null,SCRiQi smallint null,KaiCaiRiQi datetime null,WanChengRiQi datetime null,ZuBie varchar(10) null,JinE numeric(18,4) null,CBDJ numeric(18,4) null,CHRQ datetime null,CaoZuoYuan varchar(12) NULL,TiaoMaHead int null)                                   

 Create Table DINGDANMingXi(DINGDANHAO varchar(20) not null,SEHAO varchar(20) null,CHIMA varchar(20) null,SHULIANG int null,COL_S smallint null,ROW_S smallint null)     

 Create Table Employee(dept_no smallint not null,sal_no smallint null,emp_no varchar(10) not null primary key,emp_name varchar(10) null,Job varchar(30) null)        
 Create Table EmployeeAddin(Emp_No varchar(10) not null primary key)  

 Create Table FCut(dingdanhao varchar(20) null,chuanghao smallint null,riqi datetime null,zu varchar(20) null,zongchuangci smallint null,shicaishu smallint null,zhuyishixiang varchar(500) null,ZDGangHao varchar(20) null,CaoZuoYuan varchar(12) NULL,Printed BIT NULL,CCFS INT NULL)  

 Create Index iFCut on fcut(dingdanhao,chuanghao)  

 Create Table GCut(mingcheng varchar(20) null,gonghao varchar(10) null) 

 Create Table GongXuMing (xuhao int null,gongxuming varchar(60) null)  

 Create Table gz(gonghao varchar(10) not null primary key)  

 CREATE TABLE GongZi(FLCode varchar(40),PaiLie int NULL,KSRQ datetime NULL,JSRQ datetime NULL,Remarks varchar(40))

 CREATE TABLE GongZi_MX(FLCode varchar(40),GongHao varchar(40),ADD0 numeric(18,4) NULL, ADD1 numeric(18,4) NULL,ADD2 numeric(18,4) NULL,ADD3 numeric(18,4) NULL,ADD4 numeric(18,4) NULL, ADD5 numeric(18,4) NULL,ADD6 numeric(18,4) NULL,ADD7 numeric(18,4) NULL,ADD8 numeric(18,4) NULL, ADD9 numeric(18,4) NULL,ADD10 numeric(18,4) NULL,ADD11 numeric(18,4) NULL, MINUS0 numeric(18,4) NULL,MINUS1 numeric(18,4) NULL,MINUS2 numeric(18,4) NULL,MINUS3 numeric(18,4) NULL, MINUS4 numeric(18,4) NULL,MINUS5 numeric(18,4) NULL,MINUS6 numeric(18,4) NULL,MINUS7 numeric(18,4) NULL, MINUS8 numeric(18,4) NULL,MINUS9 numeric(18,4) NULL,OK_NO bit NULL,Remarks varchar(40))

 Create Table HideDate(riqi datetime null)   
 
 CREATE TABLE HideWeek (Week varchar(40) NULL)
 
 Create Table KouLing(YongHuMing varchar(20) null,MIMA varchar(20) null,xingming varchar(20) null,Permission varchar(350) null) 

 Insert into  KouLing(YONGHUMING,MIMA,xingming,Permission)VALUES ('Admin','','管理员','0') 

 Create Table KuanHao(kuanhao varchar(20) null,riqi datetime null,XiuGaiRiQi datetime null,caozuoyuan varchar(12) null,heding bit null,bili numeric(18,4) null,flag smallint null,CaiJia numeric(18,4) null,SHGongXu int null,KuanShi varchar(40) NULL,ChengFen varchar(40) NULL,BuZhong varchar(40) NULL,ZhiYang varchar(40) NULL,Remarks varchar(40) NULL,Code int null)
 
 Create Table KuanHaoPic(KuanHao varchar(40),Picture image,Extension varchar(20))  

 Create Table Leaveemployee(dept_no smallint not null,sal_no smallint null,emp_no varchar(10) not null primary key,emp_name varchar(10) null,Job varchar(30) null,LeaveReason varchar(30) null,LeaveDate datetime null)  

 Create Table Report(Code int null,Configured varchar(40) null,BillName varchar(40) null,ReportName varchar(40) null,ReportFile image null)

 Create Table STYLE(KuanHao varchar(40) not null,GX smallint null,GongXuHao smallint null,GongXuMing varchar(60) null,JiaGe1 numeric(18,4) null,JiaGe2 numeric(18,4) null,JiaGe3 numeric(18,4) null,fudongbili numeric(18,4) null,fangongbili numeric(18,4) null,DYLX varchar(40),QuotaGX smallint null,Remarks varchar(40)) 

 Create Index istyle on STYLE(KUANHAO,GONGXUHAO) 

 CREATE TABLE STYLE2(DingDanHao varchar(40),GX smallint NULL,GongXuHao smallint NULL,GongXuMing varchar(60) null,JiaGe1 numeric(18,4) NULL,JiaGe2 numeric(18,4) NULL,JiaGe3 numeric(18,4) NULL,fudongbili numeric(18,4) NULL,fangongbili numeric(18,4) null,LeiXing varchar(40),Remarks varchar(40)) 

 Create Index istyle2 on STYLE2(DingDanHao,GONGXUHAO) 

 CREATE TABLE Units (FLCode varchar(25) NULL,FLGroup varchar(25) NULL,LB int NULL,YN bit NULL ,UnitCode varchar(10) NULL,UnitName varchar(40) NULL,Relation varchar(10) NULL,Telephone varchar(20) NULL,Address varchar(60) NULL,EMail varchar(40) NULL,Facsimile varchar(20) NULL,Bank varchar(40) NULL,Account varchar(40) DEFAULT '',Note varchar(256) NULL,Price numeric(18,4) NULL,ABC VARCHAR(40) null)
 insert into  Units(FLCode,FLGroup,LB,YN)values('00000','','0','1')  

 Create Table xiangmu(xinzhong int null,mingcheng varchar(20) null,leibie tinyint null,xiaoshuwei tinyint null,IsJiben tinyint null,chuli tinyint null,xiangmudaima int null)
 insert into  xiangmu(xinzhong,mingcheng,leibie,xiaoshuwei,IsJiben,chuli,xiangmudaima)values(1,'件工工资',2,2,1,0,2) 
 insert into  xiangmu(xinzhong,mingcheng,leibie,xiaoshuwei,IsJiben,chuli,xiangmudaima)values(2,'件工工资',2,2,1,1,2) 
 insert into  xiangmu(xinzhong,mingcheng,leibie,xiaoshuwei,IsJiben,chuli,xiangmudaima)values(1,'时工工资',2,2,1,1,3) 
 insert into  xiangmu(xinzhong,mingcheng,leibie,xiaoshuwei,IsJiben,chuli,xiangmudaima)values(2,'时工工资',2,2,1,1,3) 

 CREATE TABLE ZQClient(Computer VARCHAR(40) NULL,MAC VARCHAR(40) NULL,LoginDate datetime NULL,OK_TC VARCHAR(40) NULL)

 CREATE TABLE ZQBACKUP(Code int NOT NULL DEFAULT 0,DBName varchar(40) NOT NULL DEFAULT '',DDate datetime NOT NULL DEFAULT getdate(),FileName varchar(40) NOT NULL DEFAULT '')



 Create View allemployee AS SELECT * FROM leaveemployee UNION SELECT dept_no, sal_no, emp_no, emp_name, job, NULL, NULL FROM employee  

 Create procedure alloctiaoma @num int as  declare @tiaoma int  set transaction isolation level serializable  begin transaction  select @tiaoma=tiaoma from conf  if @tiaoma>9900000  begin      select @tiaoma=1000000      update conf set tiaoma=1000000+@num    end  else    update conf set tiaoma=tiaoma+@num  commit transaction  set transaction isolation level read committed  return @tiaoma 
  
  