/*

   2002-07-24 15:46:52

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_ckd
	DROP CONSTRAINT FK_yk_ckd_1__12
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_ckd
	DROP CONSTRAINT FK_ckd_lb
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_ckd
	DROP CONSTRAINT DF_yk_ckd_ckd_rq_8__11
GO
ALTER TABLE dbo.yk_ckd
	DROP CONSTRAINT DF_yk_ckd_ckd_dh_1__16
GO
ALTER TABLE dbo.yk_ckd
	DROP CONSTRAINT DF_yk_ckd_ckd_flag
GO
ALTER TABLE dbo.yk_ckd
	DROP CONSTRAINT DF_yk_ckd_ckd_djlb
GO
CREATE TABLE dbo.Tmp_yk_ckd
	(
 	ckd_num int NOT NULL IDENTITY (1, 1),
	ckd_lb char(3) NOT NULL,
	ckd_rq smalldatetime NOT NULL CONSTRAINT DF_yk_ckd_ckd_rq_8__11 DEFAULT (getdate()),
	ckd_ksdh char(8) NULL,
	ckd_ry char(10) NULL,
	ckd_zy char(30) NULL,
	ckd_dh int NULL CONSTRAINT DF_yk_ckd_ckd_dh_1__16 DEFAULT (0),
	ckd_fkrq smalldatetime NULL,
	ckd_flag tinyint NULL CONSTRAINT DF_yk_ckd_ckd_flag DEFAULT (0),
	ckd_ckdh char(5) NULL,
	ckd_djlb char(10) NULL CONSTRAINT DF_yk_ckd_ckd_djlb DEFAULT ('²Î¿¼¼Û')
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_ckd ON
GO
IF EXISTS(SELECT * FROM dbo.yk_ckd)
	 EXEC('INSERT INTO dbo.Tmp_yk_ckd(ckd_num, ckd_lb, ckd_rq, ckd_ksdh, ckd_ry, ckd_zy, ckd_dh, ckd_fkrq, ckd_flag, ckd_ckdh, ckd_djlb)
		SELECT ckd_num, ckd_lb, ckd_rq, ckd_ksdh, ckd_ry, ckd_zy, ckd_dh, ckd_fkrq, ckd_flag, ckd_ckdh, ckd_djlb FROM dbo.yk_ckd TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_ckd OFF
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT FK_cmx_dh
GO
DROP TABLE dbo.yk_ckd
GO
EXECUTE sp_rename 'dbo.Tmp_yk_ckd', 'yk_ckd'
GO
ALTER TABLE dbo.yk_ckd ADD CONSTRAINT
	PK___7__11 PRIMARY KEY CLUSTERED 
	(
	ckd_num
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX I_ckd_ksdh ON dbo.yk_ckd
	(
	ckd_ksdh
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX I_ckd_lb ON dbo.yk_ckd
	(
	ckd_lb
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX I_ckd_rq ON dbo.yk_ckd
	(
	ckd_rq
	) ON [PRIMARY]
GO
ALTER TABLE dbo.yk_ckd WITH NOCHECK ADD CONSTRAINT
	FK_ckd_lb FOREIGN KEY
	(
	ckd_lb
	) REFERENCES dbo.zdcrlb
	(
	lb_dh
	)
GO
ALTER TABLE dbo.yk_ckd WITH NOCHECK ADD CONSTRAINT
	FK_yk_ckd_1__12 FOREIGN KEY
	(
	ckd_ksdh
	) REFERENCES dbo.yk_gydw
	(
	dw_bm
	)
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_ckdmx WITH NOCHECK ADD CONSTRAINT
	FK_cmx_dh FOREIGN KEY
	(
	cmx_dh
	) REFERENCES dbo.yk_ckd
	(
	ckd_num
	)
GO
COMMIT

/*

   2002-07-24 15:48:49

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT FK_cmx_dh
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT FK_yk_ckdmx_zdyp
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_pfj_2__11
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_lsj_1__11
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_kl_1__14
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_ysje_1__12
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_flag_1__13
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_sxsl_1__10
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_kl_1__10
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_yjsl_1__14
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_check
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_cflag
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_otcj
GO
ALTER TABLE dbo.yk_ckdmx
	DROP CONSTRAINT DF_yk_ckdmx_cmx_xydj
GO
CREATE TABLE dbo.Tmp_yk_ckdmx
	(
 	cmx_num int NOT NULL IDENTITY (1, 1),
	cmx_dh int NOT NULL,
	cmx_ypbm char(20) NOT NULL,
	cmx_bzgg char(10) NOT NULL,
	cmx_dw char(4) NULL,
	cmx_jj numeric(10, 4) NOT NULL,
	cmx_pfj numeric(10, 4) NOT NULL CONSTRAINT DF_yk_ckdmx_cmx_pfj_2__11 DEFAULT (0),
	cmx_lsj numeric(10, 4) NOT NULL CONSTRAINT DF_yk_ckdmx_cmx_lsj_1__11 DEFAULT (0),
	cmx_sl numeric(10, 2) NOT NULL,
	cmx_zznum int NULL,
	cmx_ph char(10) NULL,
	cmx_rxrq smalldatetime NULL,
	cmx_hw char(4) NULL,
	cmx_cj char(8) NULL,
	cmx_je numeric(10, 2) NULL,
	cmx_cjry char(10) NULL,
	cmx_kl1 numeric(3, 2) NULL CONSTRAINT DF_yk_ckdmx_cmx_kl_1__14 DEFAULT (1),
	cmx_fph char(15) NULL,
	cmx_ysje numeric(10, 2) NULL CONSTRAINT DF_yk_ckdmx_cmx_ysje_1__12 DEFAULT (0),
	cmx_skrq smalldatetime NULL,
	cmx_flag char(1) NULL CONSTRAINT DF_yk_ckdmx_cmx_flag_1__13 DEFAULT ('0'),
	cmx_sxsl numeric(10, 2) NULL CONSTRAINT DF_yk_ckdmx_cmx_sxsl_1__10 DEFAULT (0),
	cmx_kl numeric(5, 4) NULL CONSTRAINT DF_yk_ckdmx_cmx_kl_1__10 DEFAULT (1),
	cmx_sxdj numeric(10, 4) NULL,
	cmx_yjsl numeric(10, 2) NULL CONSTRAINT DF_yk_ckdmx_cmx_yjsl_1__14 DEFAULT (0),
	cmx_check char(20) NULL CONSTRAINT DF_yk_ckdmx_cmx_check DEFAULT (''),
	cmx_bsxm char(10) NULL,
	cmx_bscl char(10) NULL,
	cmx_cflag tinyint NULL CONSTRAINT DF_yk_ckdmx_cmx_cflag DEFAULT (0),
	cmx_otcj numeric(10, 4) NULL CONSTRAINT DF_yk_ckdmx_cmx_otcj DEFAULT (0),
	cmx_xydj numeric(10, 4) NULL CONSTRAINT DF_yk_ckdmx_cmx_xydj DEFAULT (0),
	cmx_scrq char(10) NULL
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_ckdmx ON
GO
IF EXISTS(SELECT * FROM dbo.yk_ckdmx)
	 EXEC('INSERT INTO dbo.Tmp_yk_ckdmx(cmx_num, cmx_dh, cmx_ypbm, cmx_bzgg, cmx_dw, cmx_jj, cmx_pfj, cmx_lsj, cmx_sl, cmx_zznum, cmx_ph, cmx_rxrq, cmx_hw, cmx_cj, cmx_je, cmx_cjry, cmx_kl1, cmx_fph, cmx_ysje, cmx_skrq, cmx_flag, cmx_sxsl, cmx_kl, cmx_sxdj, cmx_yjsl, cmx_check, cmx_bsxm, cmx_bscl, cmx_cflag, cmx_otcj, cmx_xydj, cmx_scrq)
		SELECT cmx_num, cmx_dh, cmx_ypbm, cmx_bzgg, cmx_dw, cmx_jj, cmx_pfj, cmx_lsj, cmx_sl, cmx_zznum, cmx_ph, cmx_rxrq, cmx_hw, cmx_cj, cmx_je, cmx_cjry, cmx_kl1, cmx_fph, cmx_ysje, cmx_skrq, cmx_flag, cmx_sxsl, cmx_kl, cmx_sxdj, cmx_yjsl, cmx_check, cmx_bsxm, cmx_bscl, cmx_cflag, cmx_otcj, cmx_xydj, cmx_scrq FROM dbo.yk_ckdmx TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_ckdmx OFF
GO
ALTER TABLE dbo.yk_xshs
	DROP CONSTRAINT f_yk_xshs_num
GO
ALTER TABLE dbo.yk_cmxs
	DROP CONSTRAINT FK_ms_num
GO
DROP TABLE dbo.yk_ckdmx
GO
EXECUTE sp_rename 'dbo.Tmp_yk_ckdmx', 'yk_ckdmx'
GO
ALTER TABLE dbo.yk_ckdmx ADD CONSTRAINT
	PK___8__11 PRIMARY KEY CLUSTERED 
	(
	cmx_num
	) ON [PRIMARY]
GO
ALTER TABLE dbo.yk_ckdmx WITH NOCHECK ADD CONSTRAINT
	FK_yk_ckdmx_zdyp FOREIGN KEY
	(
	cmx_ypbm
	) REFERENCES dbo.zdyp
	(
	yp_bm
	)
GO
ALTER TABLE dbo.yk_ckdmx WITH NOCHECK ADD CONSTRAINT
	FK_cmx_dh FOREIGN KEY
	(
	cmx_dh
	) REFERENCES dbo.yk_ckd
	(
	ckd_num
	)
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_cmxs WITH NOCHECK ADD CONSTRAINT
	FK_ms_num FOREIGN KEY
	(
	ms_num
	) REFERENCES dbo.yk_ckdmx
	(
	cmx_num
	)
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_xshs WITH NOCHECK ADD CONSTRAINT
	f_yk_xshs_num FOREIGN KEY
	(
	xs_num
	) REFERENCES dbo.yk_ckdmx
	(
	cmx_num
	)
GO
COMMIT

/*

   2002-07-24 15:49:24

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_dxjs
	DROP CONSTRAINT DF_yk_dxjs_dx_rq_2__14
GO
ALTER TABLE dbo.yk_dxjs
	DROP CONSTRAINT DF_yk_dxjs_dx_jssl_1__13
GO
ALTER TABLE dbo.yk_dxjs
	DROP CONSTRAINT DF_yk_dxjs_dx_tksl_2__13
GO
CREATE TABLE dbo.Tmp_yk_dxjs
	(
 	dx_num int NOT NULL IDENTITY (1, 1),
	dx_ckdnum int NOT NULL,
	dx_ckdmxnum int NOT NULL,
	dx_rq smalldatetime NOT NULL CONSTRAINT DF_yk_dxjs_dx_rq_2__14 DEFAULT (getdate()),
	dx_jssl numeric(10, 2) NOT NULL CONSTRAINT DF_yk_dxjs_dx_jssl_1__13 DEFAULT (0),
	dx_tksl numeric(10, 2) NULL CONSTRAINT DF_yk_dxjs_dx_tksl_2__13 DEFAULT (0),
	dx_fph char(15) NULL,
	flag tinyint NULL
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_dxjs ON
GO
IF EXISTS(SELECT * FROM dbo.yk_dxjs)
	 EXEC('INSERT INTO dbo.Tmp_yk_dxjs(dx_num, dx_ckdnum, dx_ckdmxnum, dx_rq, dx_jssl, dx_tksl, dx_fph, flag)
		SELECT dx_num, dx_ckdnum, dx_ckdmxnum, dx_rq, dx_jssl, dx_tksl, dx_fph, flag FROM dbo.yk_dxjs TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_dxjs OFF
GO
DROP TABLE dbo.yk_dxjs
GO
EXECUTE sp_rename 'dbo.Tmp_yk_dxjs', 'yk_dxjs'
GO
ALTER TABLE dbo.yk_dxjs ADD CONSTRAINT
	PK_yk_dxjs_1__14 PRIMARY KEY CLUSTERED 
	(
	dx_num
	) ON [PRIMARY]
GO
COMMIT

/*

   2002-07-24 15:49:39

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_rkd
	DROP CONSTRAINT DF_yk_rkd_rkd_dh_1__16
GO
ALTER TABLE dbo.yk_rkd
	DROP CONSTRAINT DF_yk_rkd_rkd_flag
GO
CREATE TABLE dbo.Tmp_yk_rkd
	(
 	rkd_num int NOT NULL IDENTITY (1, 1),
	rkd_lb char(2) NOT NULL,
	rkd_rq smalldatetime NOT NULL,
	rkd_hy char(8) NULL,
	rkd_ry char(10) NOT NULL,
	rkd_zy char(30) NULL,
	rkd_dh int NULL CONSTRAINT DF_yk_rkd_rkd_dh_1__16 DEFAULT (0),
	rkd_fkrq smalldatetime NULL,
	rkd_flag tinyint NULL CONSTRAINT DF_yk_rkd_rkd_flag DEFAULT (0),
	rkd_ckdh char(5) NULL
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_rkd ON
GO
IF EXISTS(SELECT * FROM dbo.yk_rkd)
	 EXEC('INSERT INTO dbo.Tmp_yk_rkd(rkd_num, rkd_lb, rkd_rq, rkd_hy, rkd_ry, rkd_zy, rkd_dh, rkd_fkrq, rkd_flag, rkd_ckdh)
		SELECT rkd_num, rkd_lb, rkd_rq, rkd_hy, rkd_ry, rkd_zy, rkd_dh, rkd_fkrq, rkd_flag, rkd_ckdh FROM dbo.yk_rkd TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_rkd OFF
GO
DROP TABLE dbo.yk_rkd
GO
EXECUTE sp_rename 'dbo.Tmp_yk_rkd', 'yk_rkd'
GO
ALTER TABLE dbo.yk_rkd ADD CONSTRAINT
	PK___5__11 PRIMARY KEY CLUSTERED 
	(
	rkd_num
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX i_rkd_lb ON dbo.yk_rkd
	(
	rkd_lb
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX i_rkd_rq ON dbo.yk_rkd
	(
	rkd_rq
	) ON [PRIMARY]
GO
COMMIT

/*

   2002-07-24 15:49:53

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT FK_yk_rkdmx_zdyp
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT DF_yk_rkdmx_rmx_bzgg_9__11
GO
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT DF_yk_rkdmx_rmx_yl_1__12
GO
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT DF_yk_rkdmx_rmx_otcj_1__13
GO
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT DF_yk_rkdmx_rmx_xydj_2__13
GO
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT DF__yk_rkdmx__rmx_th__4830B400
GO
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT DF_yk_rkdmx_rmx_flag
GO
ALTER TABLE dbo.yk_rkdmx
	DROP CONSTRAINT DF_yk_rkdmx_rmx_kl
GO
CREATE TABLE dbo.Tmp_yk_rkdmx
	(
 	rmx_num int NOT NULL IDENTITY (1, 1),
	rmx_dh int NOT NULL,
	rmx_ypbm char(20) NOT NULL,
	rmx_bzgg char(10) NOT NULL CONSTRAINT DF_yk_rkdmx_rmx_bzgg_9__11 DEFAULT ('1'),
	rmx_dw char(4) NULL,
	rmx_jj numeric(10, 4) NOT NULL,
	rmx_pfj numeric(10, 4) NOT NULL,
	rmx_lsj numeric(10, 4) NOT NULL,
	rmx_sl numeric(10, 2) NOT NULL,
	rmx_je numeric(10, 2) NOT NULL,
	rmx_ph char(10) NULL,
	rmx_rxrq smalldatetime NULL,
	rmx_hw char(4) NULL,
	rmx_cj char(8) NULL,
	rmx_fph char(15) NULL,
	rmx_fkrq smalldatetime NULL,
	rmx_yl decimal(4, 2) NULL CONSTRAINT DF_yk_rkdmx_rmx_yl_1__12 DEFAULT (0),
	rmx_cjry char(10) NULL,
	rmx_otcj numeric(10, 4) NULL CONSTRAINT DF_yk_rkdmx_rmx_otcj_1__13 DEFAULT (0),
	rmx_xydj numeric(10, 4) NULL CONSTRAINT DF_yk_rkdmx_rmx_xydj_2__13 DEFAULT (0),
	rmx_dxnum int NULL,
	rmx_yfje numeric(12, 2) NULL,
	rmx_tknum int NULL,
	rmx_thsl numeric(10, 2) NULL CONSTRAINT DF__yk_rkdmx__rmx_th__4830B400 DEFAULT (0),
	rmx_cj1 char(8) NULL,
	rmx_yjsl decimal(18, 0) NULL,
	rmx_sb char(10) NULL,
	rmx_hgz char(10) NULL,
	rmx_wgzl char(20) NULL,
	rmx_bzzl char(20) NULL,
	rmx_ysjl char(20) NULL,
	rmx_bz char(20) NULL,
	rmx_flag tinyint NOT NULL CONSTRAINT DF_yk_rkdmx_rmx_flag DEFAULT (0),
	rmx_kl numeric(5, 4) NULL CONSTRAINT DF_yk_rkdmx_rmx_kl DEFAULT (1),
	rmx_scrq char(10) NULL
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_rkdmx ON
GO
IF EXISTS(SELECT * FROM dbo.yk_rkdmx)
	 EXEC('INSERT INTO dbo.Tmp_yk_rkdmx(rmx_num, rmx_dh, rmx_ypbm, rmx_bzgg, rmx_dw, rmx_jj, rmx_pfj, rmx_lsj, rmx_sl, rmx_je, rmx_ph, rmx_rxrq, rmx_hw, rmx_cj, rmx_fph, rmx_fkrq, rmx_yl, rmx_cjry, rmx_otcj, rmx_xydj, rmx_dxnum, rmx_yfje, rmx_tknum, rmx_thsl, rmx_cj1, rmx_yjsl, rmx_sb, rmx_hgz, rmx_wgzl, rmx_bzzl, rmx_ysjl, rmx_bz, rmx_flag, rmx_kl, rmx_scrq)
		SELECT rmx_num, rmx_dh, rmx_ypbm, rmx_bzgg, rmx_dw, rmx_jj, rmx_pfj, rmx_lsj, rmx_sl, rmx_je, rmx_ph, rmx_rxrq, rmx_hw, rmx_cj, rmx_fph, rmx_fkrq, rmx_yl, rmx_cjry, rmx_otcj, rmx_xydj, rmx_dxnum, rmx_yfje, rmx_tknum, rmx_thsl, rmx_cj1, rmx_yjsl, rmx_sb, rmx_hgz, rmx_wgzl, rmx_bzzl, rmx_ysjl, rmx_bz, rmx_flag, rmx_kl, rmx_scrq FROM dbo.yk_rkdmx TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_rkdmx OFF
GO
DROP TABLE dbo.yk_rkdmx
GO
EXECUTE sp_rename 'dbo.Tmp_yk_rkdmx', 'yk_rkdmx'
GO
ALTER TABLE dbo.yk_rkdmx ADD CONSTRAINT
	PK___6__11 PRIMARY KEY CLUSTERED 
	(
	rmx_num
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX i_rmx_dh ON dbo.yk_rkdmx
	(
	rmx_dh
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX i_rmx_fph ON dbo.yk_rkdmx
	(
	rmx_fph
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX i_rmx_ypbm ON dbo.yk_rkdmx
	(
	rmx_ypbm
	) ON [PRIMARY]
GO
ALTER TABLE dbo.yk_rkdmx WITH NOCHECK ADD CONSTRAINT
	CC_rmx_sl CHECK (([rmx_sl] > 0))
GO
ALTER TABLE dbo.yk_rkdmx WITH NOCHECK ADD CONSTRAINT
	FK_yk_rkdmx_zdyp FOREIGN KEY
	(
	rmx_ypbm
	) REFERENCES dbo.zdyp
	(
	yp_bm
	)
GO
COMMIT

/*

   2002-07-24 15:50:15

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_sfmx
	DROP CONSTRAINT f_sfmx_dw
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_sfmx
	DROP CONSTRAINT f_flag_dw_fph
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_sfmx
	DROP CONSTRAINT DF_yk_sfmx_sfmx_rq_1__13
GO
CREATE TABLE dbo.Tmp_yk_sfmx
	(
 	sfmx_num int NOT NULL IDENTITY (1, 1),
	sfmx_rq smalldatetime NOT NULL CONSTRAINT DF_yk_sfmx_sfmx_rq_1__13 DEFAULT (getdate()),
	sfmx_fph char(15) NOT NULL,
	sfmx_dwbm char(8) NOT NULL,
	sfmx_je numeric(10, 2) NOT NULL,
	sfmx_flag char(1) NOT NULL,
	sfmx_ysfrq smalldatetime NULL
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_sfmx ON
GO
IF EXISTS(SELECT * FROM dbo.yk_sfmx)
	 EXEC('INSERT INTO dbo.Tmp_yk_sfmx(sfmx_num, sfmx_rq, sfmx_fph, sfmx_dwbm, sfmx_je, sfmx_flag, sfmx_ysfrq)
		SELECT sfmx_num, sfmx_rq, sfmx_fph, sfmx_dwbm, sfmx_je, sfmx_flag, sfmx_ysfrq FROM dbo.yk_sfmx TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_sfmx OFF
GO
DROP TABLE dbo.yk_sfmx
GO
EXECUTE sp_rename 'dbo.Tmp_yk_sfmx', 'yk_sfmx'
GO
ALTER TABLE dbo.yk_sfmx ADD CONSTRAINT
	PK_yk_sfmx_1__11 PRIMARY KEY CLUSTERED 
	(
	sfmx_num
	) ON [PRIMARY]
GO
ALTER TABLE dbo.yk_sfmx WITH NOCHECK ADD CONSTRAINT
	f_flag_dw_fph FOREIGN KEY
	(
	sfmx_flag,
	sfmx_dwbm,
	sfmx_fph
	) REFERENCES dbo.yk_sfkz
	(
	sf_flag,
	sf_dwbm,
	sf_fph
	)
GO
ALTER TABLE dbo.yk_sfmx WITH NOCHECK ADD CONSTRAINT
	f_sfmx_dw FOREIGN KEY
	(
	sfmx_dwbm
	) REFERENCES dbo.yk_gydw
	(
	dw_bm
	)
GO
COMMIT

/*

   2002-07-24 15:50:29

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
CREATE TABLE dbo.Tmp_yk_spcj
	(
 	cj_num int NOT NULL IDENTITY (1, 1),
	cj_cmxnum int NOT NULL,
	cj_jsnum int NOT NULL,
	cj_rq smalldatetime NOT NULL,
	cj_zy char(30) NOT NULL,
	cj_cb numeric(12, 2) NOT NULL,
	cj_sr numeric(12, 2) NOT NULL,
	cj_cj numeric(12, 2) NULL,
	cj_kl numeric(4, 2) NULL,
	cj_dwbm char(8) NOT NULL
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_spcj ON
GO
IF EXISTS(SELECT * FROM dbo.yk_spcj)
	 EXEC('INSERT INTO dbo.Tmp_yk_spcj(cj_num, cj_cmxnum, cj_jsnum, cj_rq, cj_zy, cj_cb, cj_sr, cj_cj, cj_kl, cj_dwbm)
		SELECT cj_num, cj_cmxnum, cj_jsnum, cj_rq, cj_zy, cj_cb, cj_sr, cj_cj, cj_kl, cj_dwbm FROM dbo.yk_spcj TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_spcj OFF
GO
DROP TABLE dbo.yk_spcj
GO
EXECUTE sp_rename 'dbo.Tmp_yk_spcj', 'yk_spcj'
GO
ALTER TABLE dbo.yk_spcj ADD CONSTRAINT
	PK_yk_spcj_1__12 PRIMARY KEY CLUSTERED 
	(
	cj_num
	) ON [PRIMARY]
GO
COMMIT

/*

   2002-07-24 15:50:39

   User: 

   Server: DELL

   Database: ykxt0724

   Application: SQL Server Enterprise Manager

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT FK___5__11
GO
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_bzgg
GO
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_jj
GO
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_pfj
GO
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_lsj
GO
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_sl
GO
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_rkrq_8__11
GO
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_otcj_1__13
GO
ALTER TABLE dbo.yk_zz
	DROP CONSTRAINT DF_yk_zz_zz_xydj_2__13
GO
CREATE TABLE dbo.Tmp_yk_zz
	(
 	zz_xh int NOT NULL IDENTITY (1, 1),
	zz_num int NOT NULL,
	zz_ypbm char(20) NOT NULL,
	zz_bzgg char(10) NOT NULL CONSTRAINT DF_yk_zz_zz_bzgg DEFAULT ('1'),
	zz_dw char(4) NULL,
	zz_jj numeric(10, 4) NOT NULL CONSTRAINT DF_yk_zz_zz_jj DEFAULT (0),
	zz_pfj numeric(10, 4) NOT NULL CONSTRAINT DF_yk_zz_zz_pfj DEFAULT (0),
	zz_lsj numeric(10, 4) NOT NULL CONSTRAINT DF_yk_zz_zz_lsj DEFAULT (0),
	zz_sl numeric(10, 2) NOT NULL CONSTRAINT DF_yk_zz_zz_sl DEFAULT (0),
	zz_ph char(10) NULL,
	zz_rxrq smalldatetime NULL,
	zz_hw char(4) NULL,
	zz_cj char(8) NULL,
	zz_rkrq smalldatetime NOT NULL CONSTRAINT DF_yk_zz_zz_rkrq_8__11 DEFAULT (getdate()),
	zz_otcj numeric(10, 4) NULL CONSTRAINT DF_yk_zz_zz_otcj_1__13 DEFAULT (0),
	zz_xydj numeric(10, 4) NULL CONSTRAINT DF_yk_zz_zz_xydj_2__13 DEFAULT (0),
	zz_ckdh char(5) NULL,
	zz_scrq char(10) NULL
	) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_yk_zz ON
GO
IF EXISTS(SELECT * FROM dbo.yk_zz)
	 EXEC('INSERT INTO dbo.Tmp_yk_zz(zz_xh, zz_num, zz_ypbm, zz_bzgg, zz_dw, zz_jj, zz_pfj, zz_lsj, zz_sl, zz_ph, zz_rxrq, zz_hw, zz_cj, zz_rkrq, zz_otcj, zz_xydj, zz_ckdh, zz_scrq)
		SELECT zz_xh, zz_num, zz_ypbm, zz_bzgg, zz_dw, zz_jj, zz_pfj, zz_lsj, zz_sl, zz_ph, zz_rxrq, zz_hw, zz_cj, zz_rkrq, zz_otcj, zz_xydj, zz_ckdh, zz_scrq FROM dbo.yk_zz TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_yk_zz OFF
GO
DROP TABLE dbo.yk_zz
GO
EXECUTE sp_rename 'dbo.Tmp_yk_zz', 'yk_zz'
GO
ALTER TABLE dbo.yk_zz ADD CONSTRAINT
	UQ___3__11 UNIQUE NONCLUSTERED 
	(
	zz_num
	) ON [PRIMARY]
GO
ALTER TABLE dbo.yk_zz ADD CONSTRAINT
	PK_yk_zz PRIMARY KEY NONCLUSTERED 
	(
	zz_xh
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX I_zz_ypbm_bzgg ON dbo.yk_zz
	(
	zz_ypbm,
	zz_bzgg
	) ON [PRIMARY]
GO
ALTER TABLE dbo.yk_zz WITH NOCHECK ADD CONSTRAINT
	CK_yk_zz CHECK (([zz_sl] >= 0))
GO
ALTER TABLE dbo.yk_zz WITH NOCHECK ADD CONSTRAINT
	FK___5__11 FOREIGN KEY
	(
	zz_ypbm
	) REFERENCES dbo.zdyp
	(
	yp_bm
	)
GO
COMMIT
