Book Image

Microsoft SQL Server 2008 R2 Master Data Services

Book Image

Microsoft SQL Server 2008 R2 Master Data Services

Overview of this book

Table of Contents (18 chapters)
Microsoft SQL Server 2008 R2 Master Data Services
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Deleting a member (or collection)


Deleting a member or collection follows a very similar pattern to updating a member attribute and indeed uses the same staging table (mdm.tblStgMemberAttribute) to do so. MDS follows the good practice of never permanently (or "hard") deleting any data and instead the record in the table is marked as "De-Activated".

The process to de-activate a member is to update a system attribute of the member named MDMMemberStatus. This will prevent it from appearing in the MDS user interface. The example that follows sets the value of MDMMemberStatus to "De-Activated" for the store:

/* Insert a record into the staging table that will mark a member as deactivated */
USE MDS -- replace with the name of your master data repository
GO

/* Declare the variables for use in the insert statement */
DECLARE @ModelName nvarchar(50)
DECLARE @EntityName nvarchar(50)

/* Set the variables appropriately */
SET     @ModelName  = 'Store' 
SET     @EntityName  = 'Store'
/* Insert records...