I have the following code:
set identity_insert CapModel.LedgerAmountByECMAccountByRptLOB ON
INSERT INTO [AnalyticsV2P7].[CapModel].[LedgerAmountByECMAccountByRptLOB] (AccountintDate,Ledger,Period,RptLOB,ECMAccount,Amount,AmountId)
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=E:\Database\Data\AnalyticsV2P7\LedgerAmountByECMAccountByRptLOB.xlsx', 'SELECT * FROM [Sheet1$]');
set identity_insert CapModel.LedgerAmountByECMAccountByRptLOB Off
where AmountID is an identity column where NULL values are NOT allowed. In my Excel file, that column is blank (besides the header)
I'm getting the following error message:
Cannot insert the value NULL into column 'AmountId', table 'AnalyticsV2P7.CapModel.LedgerAmountByECMAccountByRptLOB'; column does not allow nulls. INSERT fails.
I understand that no NULL values are allowed because I set it up that way but isn't it supposed to fill the identity column so there are no NULL values?
I would appreciate any help!
Thanks