Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

James Serra's Blog

James is currently a Senior Business Intelligence Architect/Developer and has over 20 years of IT experience. James started his career as a software developer, then became a DBA 12 years ago, and for the last five years he has been working extensively with Business Intelligence using the SQL Server BI stack (SSAS, SSRS, and SSIS). James has been at times a permanent employee, consultant, contractor, and owner of his own business. All these experiences along with continuous learning has helped James to develop many successful data warehouse and BI projects. James has earned the MCITP Business Developer 2008, MCITP Database Administrator 2008, and MCITP Database Developer 2008, and has a Bachelor of Science degree in Computer Engineering. His blog is at .

MDS Error: “Cannot insert the value NULL into column ‘Code’”

In Microsoft Data Services (MDS), when running a stored procedure to process a staging table (stg.udp_name_Leaf), I received this error:

“Cannot insert the value NULL into column ‘Code’, table ‘MDS2012.mdm.tblStgErrorDetail’; column does not allow nulls. INSERT fails.”

As described in the Connect item udpEntityStagingCreateLeafStoredProcedure Create Code values automatically Error, this is a bug that will be fixed in SQL Server 2012 Service Pack 1.

The issue is that there is a bug in the stored procedure when an Entity has been marked for “Create Code values automatically”.  If you insert a member and one of the attributes is a domain attribute that doesn’t exist, you will get the above error.  What is happening is that the code is null when trying to insert into [mdm].[tblStgErrorDetail] and the reason for it being null is that it hasn’t been generated yet.

In my case I was processing an entity called TblFacility and putting values in a foreign key field called FacilityOwnership_FK, which is a domain-based attribute linking to an entity called RefOwnershipType, and RefOwnershipType was empty.

Note you can run the stored procedure stg.udp_Name_Leaf (i.e. stg.udp_TblFacility_Leaf) in SSMS to see the line number it bombs on to find out which foreign key is having the problem.

Comments

Leave a comment on the original post [www.jamesserra.com, opens in a new window]

Loading comments...