解决方案: |
UPDATE GL_accsum
SET mb = 0, md = 0, mc = 0, me = 0, mb_f = 0, md_f = 0, mc_f = 0,me_f = 0, nb_s = 0, nd_s = 0,
nc_s = 0, ne_s = 0
WHERE (mb IS NULL) OR
(md IS NULL) OR
(mc IS NULL) OR
(me IS NULL) OR
(mb_f IS NULL) OR
(md_f IS NULL) OR
(mc_f IS NULL) OR
(me_f IS NULL) OR
(nb_s IS NULL) OR
(nd_s IS NULL) OR
(nc_s IS NULL) OR
(ne_s IS NULL)
UPDATE GL_accass
SET mb = 0, md = 0, mc = 0, me = 0, mb_f = 0, md_f = 0, mc_f = 0,me_f = 0, nb_s = 0, nd_s = 0,
nc_s = 0, ne_s = 0
WHERE (mb IS NULL) OR
(md IS NULL) OR
(mc IS NULL) OR
(me IS NULL) OR
(mb_f IS NULL) OR
(md_f IS NULL) OR
(mc_f IS NULL) OR
(me_f IS NULL) OR
(nb_s IS NULL) OR
(nd_s IS NULL) OR
(nc_s IS NULL) OR
(ne_s IS NULL)
--删除、建立、绑定默认值
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_mb_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_mb_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_mc_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_mc_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_mc_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_mc_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_md_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_md_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_md_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_md_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_me_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_me_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_me_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_me_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_nb_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_nb_s_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_nc_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_nc_s_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_nd_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_nd_s_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_ne_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_ne_s_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accass_mb_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accass_mb_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_mb_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_mb_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_mb_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_mb_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_mc_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_mc_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_mc_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_mc_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_md_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_md_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_md_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_md_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_me_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_me_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_me_f_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_me_f_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_nb_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_nb_s_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_nc_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_nc_s_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_nd_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_nd_s_D]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GL_accsum_ne_s_D]') and OBJECTPROPERTY(id, N'IsDefault') = 1)
drop default [dbo].[GL_accsum_ne_s_D]
GO
CREATE DEFAULT dbo.GL_accass_mb_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_mc_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_mc_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_md_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_md_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_me_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_me_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_nb_s_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_nc_s_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_nd_s_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_ne_s_D AS 0
GO
CREATE DEFAULT dbo.GL_accass_mb_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_mb_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_mb_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_mc_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_mc_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_md_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_md_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_me_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_me_f_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_nb_s_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_nc_s_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_nd_s_D AS 0
GO
CREATE DEFAULT dbo.GL_accsum_ne_s_D AS 0
GO
EXEC sp_bindefault N'[dbo].[GL_accass_mb_D]', N'[GL_accass].[mb]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_mb_f_D]', N'[GL_accass].[mb_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_mc_D]', N'[GL_accass].[mc]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_mc_f_D]', N'[GL_accass].[mc_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_md_D]', N'[GL_accass].[md]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_md_f_D]', N'[GL_accass].[md_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_me_D]', N'[GL_accass].[me]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_me_f_D]', N'[GL_accass].[me_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_nb_s_D]', N'[GL_accass].[nb_s]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_nc_s_D]', N'[GL_accass].[nc_s]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_nd_s_D]', N'[GL_accass].[nd_s]'
GO
EXEC sp_bindefault N'[dbo].[GL_accass_ne_s_D]', N'[GL_accass].[ne_s]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_mb_D]', N'[GL_accsum].[mb]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_mb_f_D]', N'[GL_accsum].[mb_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_mc_D]', N'[GL_accsum].[mc]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_mc_f_D]', N'[GL_accsum].[mc_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_md_D]', N'[GL_accsum].[md]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_md_f_D]', N'[GL_accsum].[md_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_me_D]', N'[GL_accsum].[me]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_me_f_D]', N'[GL_accsum].[me_f]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_nb_s_D]', N'[GL_accsum].[nb_s]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_nc_s_D]', N'[GL_accsum].[nc_s]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_nd_s_D]', N'[GL_accsum].[nd_s]'
GO
EXEC sp_bindefault N'[dbo].[GL_accsum_ne_s_D]', N'[GL_accsum].[ne_s]'
GO
--更新总帐、辅助总帐表单结构
ALTER TABLE GL_accsum ALTER COLUMN cbegind_c varchar(2) not NULL
ALTER TABLE GL_accsum ALTER COLUMN cbegind_c_engl varchar(2) not NULL
ALTER TABLE GL_accsum ALTER COLUMN mb money not NULL
ALTER TABLE GL_accsum ALTER COLUMN md money not NULL
ALTER TABLE GL_accsum ALTER COLUMN mc money not NULL
ALTER TABLE GL_accsum ALTER COLUMN cendd_c varchar(2) not NULL
ALTER TABLE GL_accsum ALTER COLUMN cendd_c_engl varchar(2) not NULL
ALTER TABLE GL_accsum ALTER COLUMN me money not NULL
ALTER TABLE GL_accsum ALTER COLUMN mb_f money not NULL
ALTER TABLE GL_accsum ALTER COLUMN md_f money not NULL
ALTER TABLE GL_accsum ALTER COLUMN mc_f money not NULL
ALTER TABLE GL_accsum ALTER COLUMN me_f money not NULL
ALTER TABLE GL_accsum ALTER COLUMN nb_s float not NULL
ALTER TABLE GL_accsum ALTER COLUMN nd_s float not NULL
ALTER TABLE GL_accsum ALTER COLUMN nc_s float not NULL
ALTER TABLE GL_accsum ALTER COLUMN ne_s float not NULL
--跟新辅助总帐结构
ALTER TABLE GL_accass ALTER COLUMN cbegind_c varchar(2) not NULL
ALTER TABLE GL_accass ALTER COLUMN cbegind_c_engl varchar(2) not NULL
ALTER TABLE GL_accass ALTER COLUMN mb money not NULL
ALTER TABLE GL_accass ALTER COLUMN md money not NULL
ALTER TABLE GL_accass ALTER COLUMN mc money not NULL
ALTER TABLE GL_accass ALTER COLUMN cendd_c varchar(2) not NULL
ALTER TABLE GL_accass ALTER COLUMN cendd_c_engl varchar(2) not NULL
ALTER TABLE GL_accass ALTER COLUMN me money not NULL
ALTER TABLE GL_accass ALTER COLUMN mb_f money not NULL
ALTER TABLE GL_accass ALTER COLUMN md_f money not NULL
ALTER TABLE GL_accass ALTER COLUMN mc_f money not NULL
ALTER TABLE GL_accass ALTER COLUMN me_f money not NULL
ALTER TABLE GL_accass ALTER COLUMN nb_s float not NULL
ALTER TABLE GL_accass ALTER COLUMN nd_s float not NULL
ALTER TABLE GL_accass ALTER COLUMN nc_s float not NULL
ALTER TABLE GL_accass ALTER COLUMN ne_s float not NULL
|