SQL Server MDS : How to Know Actual MDS Table name for Model Entity and Column name for the Attribute

How to Know Actual MDS Table name for Model Entity and Column name for the Attribute .


here is the Script 


USE MDS

------------------------------------------------------------
-- TODO: Define Model name, Entity name, and Attribute Name
       DECLARE @Model NVARCHAR(50)       = '<<GiveModelName>>';
       DECLARE @Entity_Name NVARCHAR(50) = '<<GiveEntityName>>';
       DECLARE @Attribute_Name NVARCHAR(50)= '<<GiveAttributeName>>';
------------------------------------------------------------

-- Set @Table name
       DECLARE @Table NVARCHAR(128);    
       SELECT @Table = EntityTable FROM mdm.viw_SYSTEM_SCHEMA_ENTITY WHERE Model_Name= @Model AND name= @Entity_Name ;

-- Set @Column name       
       DECLARE @Column NVARCHAR(128)

       SELECT  @Column  = Attribute_Column FROM mdm.viw_SYSTEM_SCHEMA_ATTRIBUTES WHERE Model_Name = @Model AND Entity_Name= @Entity_Name AND Attribute_Name = @Attribute_Name;


SELECT @Table as EntityTableInMDS , @Column as ColumnNameofAttribute

Comments

Popular posts from this blog

SSAS : A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running. (Microsoft.AnalysisServices.AdomdClient). + Solution

SSIS Error : Unable to infer the XSD from the XML file. The XML contains multiple namespaces