May 14th, 2009, 03:58 PM
|
Wrox Author
|
|
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Correction
The issue is the identity field was not on the script file. Either add the identity field or run this to drop the existing bank batch detail table and replace with correct structure.
Code:
USE [CaseStudy]
GO
DROP TABLE BankBatchDetail
GO
CREATE TABLE [dbo].[BankBatchDetail](
[BankBatchDtlID] [int] IDENTITY(1,1) NOT NULL,
[BankBatchID] [int] NOT NULL,
[RawInvoiceNbr] [nvarchar](50) NULL,
[RawAccountNbr] [nvarchar](50) NULL,
[ReferenceData1] [nvarchar](50) NULL,
[ReferenceData2] [nvarchar](50) NULL,
[MatchedInvoiceID] [int] NULL,
[MatchedCustomerID] [int] NULL,
[MatchedDate] [datetime] NULL,
[PaymentAmount] [money] NULL,
CONSTRAINT [PK_BankBatchDtlID] PRIMARY KEY CLUSTERED
(
[BankBatchDtlID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BankBatchDetail] WITH NOCHECK ADD CONSTRAINT [FK_BankBatchDetail_BankBatchID] FOREIGN KEY([BankBatchID])
REFERENCES [dbo].[BankBatch] ([BankBatchID])
GO
ALTER TABLE [dbo].[BankBatchDetail] CHECK CONSTRAINT
[FK_BankBatchDetail_BankBatchID]
GO
ALTER TABLE [dbo].[BankBatchDetail] WITH CHECK ADD CONSTRAINT
[FK_BankBatchDetail_CustomerID] FOREIGN KEY([MatchedCustomerID])
REFERENCES [dbo].[Customer] ([CustomerID])
GO
ALTER TABLE [dbo].[BankBatchDetail] WITH CHECK ADD CONSTRAINT
[FK_BankBatchDetail_InvoiceID] FOREIGN KEY([MatchedInvoiceID])
REFERENCES [dbo].[Invoice] ([InvoiceID])
GO
Thanks,
Douglas
|