问题原因: |
经过对比发现2003,2004两年的IA_Subsidiary没有NF1,NF2的索引,但是2005年的数据库中存在此索引。 860sp中本身也有此索引。 怀疑是由于某补丁引起的表结构的变化引起的。 升级中报错的语句位置如下: --2003-10-29 张巍 add end --2004-4-21 为解决效率增加索引 --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_Subsidiary') and name='nf1') CREATE NONCLUSTERED INDEX nf1 ON dbo.IA_Subsidiary ( cVouType, iPZID, cPZID ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_Subsidiary') and name='nf2') CREATE NONCLUSTERED INDEX nf2 ON dbo.IA_Subsidiary ( iPZID ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_HeadSet') and name='nf1') CREATE NONCLUSTERED INDEX nf1 ON dbo.IA_HeadSet ( cInvCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_HeadSet') and name='nf2') CREATE NONCLUSTERED INDEX nf2 ON dbo.IA_HeadSet ( cInvCode, cWhCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_HeadSet') and name='nf3') CREATE NONCLUSTERED INDEX nf3 ON dbo.IA_HeadSet ( cInvCCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_HeadSet') and name='nf4') CREATE NONCLUSTERED INDEX nf4 ON dbo.IA_HeadSet ( cInvCCode, cWhCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_OppHead') and name='nf1') CREATE NONCLUSTERED INDEX nf1 ON dbo.IA_OppHead ( cRdCode, cInvCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_OppHead') and name='nf2') CREATE NONCLUSTERED INDEX nf2 ON dbo.IA_OppHead ( cRdCode, cInvCCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_OppHead') and name='nf3') CREATE NONCLUSTERED INDEX nf3 ON dbo.IA_OppHead ( cRdCode, cDepCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_OppHead') and name='nf4') CREATE NONCLUSTERED INDEX nf4 ON dbo.IA_OppHead ( cInvCode, cDepCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_OppHead') and name='nf5') CREATE NONCLUSTERED INDEX nf5 ON dbo.IA_OppHead ( cRdCode, cInvCode, cDepCode ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_OppHead') and name='nf6') CREATE NONCLUSTERED INDEX nf6 ON dbo.IA_OppHead ( cRdCode, cItemCode, cItem_class ) ON [PRIMARY] --go --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_EnSubsidiary') and name='IX_CalDif') Create NonClustered Index IX_CalDif On IA_EnSubsidiary ( cWhCode asc, cInvCode asc, iMonth asc, cVouType asc ) --go --2004-4-21 继续增加 --IF not EXISTS(SELECT name FROM sysindexes WHERE id=object_id('IA_enSubsidiary') and name='gz1') CREATE NONCLUSTERED INDEX gz1 ON dbo.IA_enSubsidiary ( cVouType, iPZID, cPZID ) ON [PRIMARY] |