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 .

Master Data Services (MDS): Bug deleting an attribute

UPDATE on 11/28/2012:  I had this same error when trying to delete a model.  Fortunately, SQL Server 2012 SP1 has fixed this bug!

In Master Data Services (MDS), when trying to delete an attribute in an entity, I received the following error:

“Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.”

Note I also received the same error when using the MDS add-in in Excel and tried to change the maximum length of an attribute.

From reading Cannot delete a domain based attribute from an entity – Metadata issues, it seems this happens because the “Attribute Metadata Definition” table that is defined in mdm.tblEntity (in which is shows that it points to tbl_1_4_EN in my database) contains two attributes that share the same ObjectId (hence the “subquery returned more than one value” error).  To find out if you have duplicate ObjectId’s, execute this code:

SELECT name, ObjectId, COUNT(*) FROM mdm.tbl_1_4_EN
GROUP BY Name, [OBJECTID]
HAVING COUNT(*) > 1

It looks like this problem is caused by deleting a Model using the user interface. The attribute metadata and attribute group metadata seems to persist even when the model is deleted.  When the model is deployed again in the same DB, you get duplicate records.

This is a confirmed bug that hopefully will be fixed in SP1 of SQL Server 2012.  An unsupported workaround:

To remove the records modify [mdm].[udpUserDefinedMetadataDelete]:

***Warning only works if the last record is valid. Perform a backup before doing this!!!

– Get the member id
SET @MemberIdSQL = N’SET @MemberId = (SELECT ID FROM mdm.’ + @MemberTableName + N’ WHERE Status_ID = 1 AND ObjectId = @Object_ID)’

to

– Get the member id
SET @MemberIdSQL = N’SET @MemberId = (SELECT Top 1 ID FROM mdm.’ + @MemberTableName + N’ WHERE Status_ID = 1 AND ObjectId = @Object_ID)’

Then run:

DECLARE @Object_ID UNIQUEIDENTIFIER = ’9E36F7C6-2DA5-4786-B6E0-35E7CEDB8AAE’
EXEC [mdm].[udpUserDefinedMetadataDelete] ‘Attribute’, @Object_ID

multiple times until one record remains.  Don’t forget to remove the changes to udpUserDefinedMetadataDelete when completed.

Comments

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

Loading comments...