Revisions Spec Exercise Steps: Map Source to Target

  1. Open the revisions file to edit.
  2. Add a section for Source-Target mappings. For more information, see the example at Revisions Spec: Map Source to Target
  3. Use "20" to number the ID for the revision.

    <DBRevision ID="20">
    </DBRevision>
  4. Within <DBRevision ID="20">, add elements to embed Transact-SQL code.

        <ExecuteSql>
          <![CDATA[
        ] ]>
        </ExecuteSql>

    For more information about CDATA sections, see Microsoft's MSDN article at CDATA Sections [XML Standards].

    Within that, add Transact-SQL code to create a comments for the table and each column. To create comments, use a stored procedure called USP_SCHEMA_TABLE_SETTABLECOMMENT or USP_SCHEMA_TABLE_SETCOLUMNCOMMENT. This stored procedure for columns accepts these parameters:

    1. TYPE
    2. TABLENAME
    3. COLUMNNAME
    4. COMMENT

    USP_SCHEMA_TABLE_SETTABLECOMMENTaccepts these parameters:

    1. TABLENAME
    2. COMMENT

    USP_SCHEMA_TABLE_SETTABLECOMMENT or USP_SCHEMA_TABLE_SETCOLUMNCOMMENTthen add a comment based on the parameters. For more information about stored procedures, see Stored Procedures (Database Engine). For more information about

    For example, for the table comment, add this line:

    exec BBDW.USP_SCHEMA_TABLE_SETTABLECOMMENT 'FACT_INTERACTIONRESPONSE_EXT', 'The Interaction Response fact relates responses to constituent interactions.';
  5. Save your revisions file.

    The revision should look like this:

      <DBRevision ID="20">
        <ExecuteSql>
          <![CDATA[	
    exec BBDW.USP_SCHEMA_TABLE_SETTABLECOMMENT 'FACT_INTERACTIONRESPONSE_EXT', 'The Interaction Response fact relates responses to constituent interactions.';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'INTERACTIONRESPONSEFACTID','Surrogate key for Interaction Response fact.';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'INTERACTIONRESPONSESYSTEMID','dbo.[INTERACTIONRESPONSE].[ID]';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'INTERACTIONFACTID','Reference key to the interaction fact, derived from dbo.[INTERACTIONRESPONSE].[INTERACTIONID]';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'RESPONSEDIMID','Reference key to the response dimension, derived from dbo.[INTERACTIONRESPONSE].[RESPONSEID]';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'INTERACTIONRESPONSEDATEDIMID','Reference key to the date dimension, derived from dbo.[INTERACTIONRESPONSE].[DATE]';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'INTERACTIONRESPONSEDATE','dbo.[INTERACTIONRESPONSE].[DATE]';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'ISINCLUDED','Flag indicating when data should be included in results.';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'ETLCONTROLID','ID generated through the ETL process';
    exec BBDW.USP_SCHEMA_TABLE_SETCOLUMNCOMMENT 'MS_Description', 'FACT_INTERACTIONRESPONSE_EXT', 'SOURCEDIMID','Source system used';
        ] ]>
        </ExecuteSql>
      </DBRevision>