Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 KEY Error

Author  Topic 

bvanyangu
Starting Member

20 Posts

Posted - 2014-06-12 : 13:03:06
I have this Borrower_Key column as "Not Null" yet I still get the below Error.I don't know what to do



Description: "Cannot insert the value NULL into column 'Borrower_Key', table 'OLAP.dbo.Fact_FinancialsPRACTICE';
column does not allow nulls. INSERT fails.".

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-06-12 : 13:05:12
You need to fix the INSERT code so that it isn't trying to insert a NULL value into a column that doesn't allow nulls. Show us the INSERT code.

If you want it to allow nulls, then alter the column to NULL instead of NOT NULL.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

bvanyangu
Starting Member

20 Posts

Posted - 2014-06-12 : 15:57:00
CREATE TABLE Fact_Financials (
[Financial_Key] INT Identity(1,1),
[Borrower_Key] INT,
[Property_Key] INT,
[Loan_Key] INT,
[YearsAtThisAddress] [int] NULL,
[LoanAmount] [int] NULL,
[Purchase Price] [int] NULL,
[Number of Units] [int] NULL,
[MonthlyIncome] [varchar](50) NULL,
[Bonuses] [varchar](50) NULL,
[Commission] [varchar](50) NULL,
[OtherIncome] [varchar](50) NULL,
[Checking] [int] NULL,
[Savings] [int] NULL,
[RetirementFund] [int] NULL,
[MutualFund] [int] NULL
)
Go to Top of Page

bvanyangu
Starting Member

20 Posts

Posted - 2014-06-12 : 15:59:11
I am using SSIS to insert the data

CREATE TABLE Fact_Financials (
[Financial_Key] INT Identity(1,1),
[Borrower_Key] INT,
[Property_Key] INT,
[Loan_Key] INT,
[YearsAtThisAddress] [int] NULL,
[LoanAmount] [int] NULL,
[Purchase Price] [int] NULL,
[Number of Units] [int] NULL,
[MonthlyIncome] [varchar](50) NULL,
[Bonuses] [varchar](50) NULL,
[Commission] [varchar](50) NULL,
[OtherIncome] [varchar](50) NULL,
[Checking] [int] NULL,
[Savings] [int] NULL,
[RetirementFund] [int] NULL,
[MutualFund] [int] NULL
)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-06-12 : 16:10:11
Please read my post.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2014-06-13 : 04:48:55
try change the column into null
Go to Top of Page

bvanyangu
Starting Member

20 Posts

Posted - 2014-06-13 : 11:53:14
I tried both ways, it didn't help. Thanks for the responds.
Go to Top of Page
   

- Advertisement -