问题现象:(11.510.000.0000)升级账套出错:CS_BankCashAccessVoucher' 已经有针对它定义的主键
升级出错,错误信息:升级脚本出错,错误信息:SQL 脚本: 11.510.000.0000 DATA_DSTR_FI_Vou_NL.sql 出错:表 'CS_BankCashAccessVoucher' 已经有针对它定义的主键。
解决方案:提示哪个表就删除哪个表的主键,语句如下,不能全部执行。(操作前请备份好您用友T+财务软件中的数据,可参考教程:https://www.ywufida.cn/jcufida/1389.html)
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_BankCashAccessVoucher]') AND name = N'PK_CS_BankCashAccessVoucher')
ALTER TABLE [dbo].[CS_BankCashAccessVoucher] DROP CONSTRAINT [PK_CS_BankCashAccessVoucher]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_CashAccountPeriodBeginning_b]') AND name = N'PK_CS_CashAccountPeriodBeginning_b')
ALTER TABLE [dbo].[CS_CashAccountPeriodBeginning_b] DROP CONSTRAINT [PK_CS_CashAccountPeriodBeginning_b]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_ExpenseVoucher_b]') AND name = N'PK_CS_ExpenseVoucher_b')
ALTER TABLE [dbo].[CS_ExpenseVoucher_b] DROP CONSTRAINT [PK_CS_ExpenseVoucher_b]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_ExpenseVoucher_MultiSettle]') AND name = N'PK_CS_ExpenseVoucher_MultiSettle')
ALTER TABLE [dbo].[CS_ExpenseVoucher_MultiSettle] DROP CONSTRAINT [PK_CS_ExpenseVoucher_MultiSettle]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_ExpenseVoucher]') AND name = N'PK_CS_ExpenseVoucher')
ALTER TABLE [dbo].[CS_ExpenseVoucher] DROP CONSTRAINT [PK_CS_ExpenseVoucher]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_IncomeVoucher_b]') AND name = N'PK_CS_IncomeVoucher_b')
ALTER TABLE [dbo].[CS_IncomeVoucher_b] DROP CONSTRAINT [PK_CS_IncomeVoucher_b]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_IncomeVoucher_MultiSettle]') AND name = N'PK_CS_IncomeVoucher_MultiSettle')
ALTER TABLE [dbo].[CS_IncomeVoucher_MultiSettle] DROP CONSTRAINT [PK_CS_IncomeVoucher_MultiSettle]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[CS_IncomeVoucher]') AND name = N'PK_CS_IncomeVoucher')
ALTER TABLE [dbo].[CS_IncomeVoucher] DROP CONSTRAINT [PK_CS_IncomeVoucher]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_Detail]') AND name = N'PK_ARAP_Detail')
ALTER TABLE [dbo].[ARAP_Detail] DROP CONSTRAINT [PK_ARAP_Detail]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ExchangeAdjust]') AND name = N'PK_ARAP_ExchangeAdjust')
ALTER TABLE [dbo].[ARAP_ExchangeAdjust] DROP CONSTRAINT [PK_ARAP_ExchangeAdjust]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ExchangeAdjust_ApDetail]') AND name = N'PK_ARAP_ExchangeAdjust_ApDetail')
ALTER TABLE [dbo].[ARAP_ExchangeAdjust_ApDetail] DROP CONSTRAINT [PK_ARAP_ExchangeAdjust_ApDetail]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ExchangeAdjust_ArDetail]') AND name = N'PK_ARAP_ExchangeAdjust_ArDetail')
ALTER TABLE [dbo].[ARAP_ExchangeAdjust_ArDetail] DROP CONSTRAINT [PK_ARAP_ExchangeAdjust_ArDetail]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_OriginalAmount]') AND name = N'PK_ARAP_OriginalAmount')
ALTER TABLE [dbo].[ARAP_OriginalAmount] DROP CONSTRAINT [PK_ARAP_OriginalAmount]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_OriginalAmount_ApDetail]') AND name = N'PK_ARAP_OriginalAmount_ApDetail')
ALTER TABLE [dbo].[ARAP_OriginalAmount_ApDetail] DROP CONSTRAINT [PK_ARAP_OriginalAmount_ApDetail]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_OriginalAmount_ArDetail]') AND name = N'PK_ARAP_OriginalAmount_ArDetail')
ALTER TABLE [dbo].[ARAP_OriginalAmount_ArDetail] DROP CONSTRAINT [PK_ARAP_OriginalAmount_ArDetail]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ReceivePayment]') AND name = N'PK_ARAP_ReceivePayment')
ALTER TABLE [dbo].[ARAP_ReceivePayment] DROP CONSTRAINT [PK_ARAP_ReceivePayment]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ReceivePayment_b]') AND name = N'PK_ARAP_ReceivePayment_b')
ALTER TABLE [dbo].[ARAP_ReceivePayment_b] DROP CONSTRAINT [PK_ARAP_ReceivePayment_b]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ReceivePayment_MultiPayment]') AND name = N'PK_ARAP_ReceivePayment_MultiPayment')
ALTER TABLE [dbo].[ARAP_ReceivePayment_MultiPayment] DROP CONSTRAINT [PK_ARAP_ReceivePayment_MultiPayment]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ReceivePayment_MultiSettle]') AND name = N'PK_ARAP_ReceivePayment_MultiSettle')
ALTER TABLE [dbo].[ARAP_ReceivePayment_MultiSettle] DROP CONSTRAINT [PK_ARAP_ReceivePayment_MultiSettle]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_StrikeBalance]') AND name = N'PK_ARAP_StrikeBalance')
ALTER TABLE [dbo].[ARAP_StrikeBalance] DROP CONSTRAINT [PK_ARAP_StrikeBalance]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_StrikeBalance_FirstDetail]') AND name = N'PK_ARAP_StrikeBalance_FirstDetail')
ALTER TABLE [dbo].[ARAP_StrikeBalance_FirstDetail] DROP CONSTRAINT [PK_ARAP_StrikeBalance_FirstDetail]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_StrikeBalance_SecondDetail]') AND name = N'PK_ARAP_StrikeBalance_SecondDetail')
ALTER TABLE [dbo].[ARAP_StrikeBalance_SecondDetail] DROP CONSTRAINT [PK_ARAP_StrikeBalance_SecondDetail]
GO
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ARAP_ExchangeAdjust]') AND name = N'PK_ARAP_ExchangeAdjust')
ALTER TABLE [dbo].[ARAP_ExchangeAdjust] DROP CONSTRAINT [PK_ARAP_ExchangeAdjust]
GO