You are here: Decision Strategy Manager > Interaction History > Applying sample scripts for archiving and purging > Deleting the records from the FACT table in Microsoft SQL Server databases

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

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)