Close popover

Table of Contents

Deleting the records from the FACT table in Microsoft SQL Server databases

Version:

Perform this procedure to delete records from the FACT table in a Microsoft SQL Server database.

  1. Connect to the source database.

  2. Execute the following script:

    DELETE FROM <SOURCE_DATABASE>.<SOURCE_SCHEMA>.PR_DATA_IH_FACT WHERE PXOUTCOMETIME < CONVERT(data_type(length),expression,style);

Example

DELETE FROM <SOURCE_DATABASE>.<SOURCE_SCHEMA>.PR_DATA_IH_FACT WHERE PXOUTCOMETIME < CONVERT(DATETIME,'30-06-15 10:34:09 PM',5);, where:

data_type is DATETIME

expression is the date value in quotes

style is 5 (Italian format)

  • Applying sample scripts for archiving and purging

    The interaction history tables contain transactional data which may grow fast. By using the sample scripts, the users can archive the data in the archiving database and delete (purge) the records from the source database. The scripts allow you to move the FACT table records, merge the Dimension records, and delete the records from the FACT table. Before you use any of the scripts, back up the source and target interaction history tables and create indexes on the columns. Indexes improve performance when you read data from the archived tables.

  • Applying interaction history scripts in Oracle databases

    Use interaction history scripts with Oracle databases to archive or purge the interaction history tables on Windows OS. The scripts allow you to move the FACT table records, merge the Dimension records, and delete the records from the FACT table.

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.