情况一: 在变动已经变动过的卡片, 不让保存, 提示: 表‘AIS20070122081642.dbo.t_FABalExpense’;该列不允许空值。INSERT 失败。
情况二: 变动卡片时提示,可能由于网络问题卡片保存失败请重新保存(pt004072)
这两种情况通常都是由于 t_fabalexpense 表体损坏,需要重新生成该表.
解决方法:
可以在企业管理器中,通过其他完好帐套的fabalexpense 表生成SQL 脚本语句,再在有问题帐套中执行该脚本重新生成fabalexpense 表。
具体步骤:
–1,把原t_fabalexpense 表数据备份到临时表:
select * into aaa from t_fabalexpense
–2,执行脚本重新生成fabalexpense 表:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[t_FABalExpense]’) and OBJECTPROPERTY(id,
N’IsUserTable’) = 1)
drop table [dbo].[t_FABalExpense]
GO
CREATE TABLE [dbo].[t_FABalExpense] (
[FBalID] [int] NOT NULL ,
[FAcctID] [int] NOT NULL ,
[FDetailID] [int] NOT NULL ,
[FRate] [decimal](28, 10) NOT NULL ,
[FAmount] [money] NOT NULL ,
[fdeptid] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[t_FABalExpense] WITH NOCHECK ADD
CONSTRAINT [PK_t_FABalExpense] PRIMARY KEY CLUSTERED
(
[FBalID],
[FAcctID],
[FDetailID],
[fdeptid]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[t_FABalExpense] ADD
CONSTRAINT [DF_t_FABalExpense_FAcctID] DEFAULT (0) FOR [FAcctID],
CONSTRAINT [DF_t_FABalExpense_FDetailID] DEFAULT (0) FOR [FDetailID],
CONSTRAINT [DF__t_fabalex__fdept__7A12F3AE] DEFAULT (0) FOR [fdeptid]
GO
ALTER TABLE [dbo].[t_FABalExpense] ADD
CONSTRAINT [FK_t_FABalExpense_t_FABalance] FOREIGN KEY
([FBalID]
) REFERENCES [dbo].[t_FABalance] ([FBalID]
)
GO
–3,把数据从备份表插回新表:
insert into t_fabalexpense select * from aaa
–4,清除备份表:
drop table aaa