Search code examples
master-data-services

MDS import data queue


I am following this guidance: https://www.mssqltips.com/sqlservertutorial/3806/sql-server-master-data-services-importing-data/

The instructions say after we load data into the staging tables, we go into the MDS integration screen and select "START BATCHES".

Is this a manual override to begin the process? or how do I know how to automatically queue up a batch to begin?

Thanks!


Solution

  • Alternative way to run the staging process

    After you load the staging table with required data.. call/execute the Staging UDP.
    Basically, Staging UDPs are different Stored Procedures for every entity in the MDS database (automatically created by MDS) that follow the naming convention:

    stg.udp_<EntityName>_Leaf
    

    You have to provide it values for some parameters. Here is a sample code of how to call these.

    USE [MDS_DATABASE_NAME]  
    GO
    
    EXEC [stg].[udp_entityname_Leaf]
          @VersionName = N'VERSION_1',
          @LogFlag = 1,
          @BatchTag = N'batch1'
          @UserName=N’domain\user’
    
    GO  
    

    For more details look at: Staging Stored Procedure (Master Data Services).
    Do remember that the @BatchTag value has to match the value that you initially populated in the Staging table.

    Automating the Staging process

    The simplest way for you to do that would be to schedule a job in SQL Agent which would execute something like the code above to call the staging UDP. Please note that you would need to get creative about figuring out how the Job will know the correct Batch Tag.

    That said, a lot of developers just create a single SSIS Package which does the Loading of data in the Staging table (as step 1) and then Executes the Staging UDP (as the final step). This SSIS package is then executed through a scheduled SQL Agent job.