> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sync.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Querying: CHECKCACHE Command

The CheckCache command repairs the destination copy of the data after you run a REPLICATE command.

#### CHECKCACHE Syntax

```sql theme={null}
CHECKCACHE DestinationTable 
  AGAINST { SourceTable | ( SelectStatement )}
  [ WITH REPAIR ] 
  [ SKIP { MODIFIED | DELETED }]
  [ START {Datetime | DatetimeFunction}] 
  [ END {Datetime | DatetimeFunction}]
```

#### Common CheckCache Queries

Use the following statement to validate and repair the destination table. This command queries both the source and destination tables, inserts any missing records in the destination, updates any outdated records in the destination, and removes any records that are missing in the source.

```sql theme={null}
CHECKCACHE DestinationTable AGAINST SourceTable WITH REPAIR;
```

Use the following statement to repair the cache only within the specified date range.

```sql theme={null}
CHECKCACHE DestinationTable AGAINST SourceTable WITH REPAIR START '2018-01-01' END '2019-01-01'
```

Use the following statement to repair certain columns in the cache that are only within the specified date range.

```sql theme={null}
CHECKCACHE DestinationTable AGAINST (SELECT Id, Name, DateModified FROM SourceTable) WITH REPAIR START '2018-01-01' END '2019-01-01'
```

Use the following statement to repair the cache database only by removing deleted records over the previous month.

```sql theme={null}
CHECKCACHE DestinationTable AGAINST SourceTable WITH REPAIR SKIP MODIFIED START LAST_MONTH()
```
