> For the complete documentation index, see [llms.txt](https://center-for-the-integration-of-id.gitbook.io/generate-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://center-for-the-integration-of-id.gitbook.io/generate-documentation/developer-guides/generate-utilities/cleanup-debug-tables.md).

# Cleanup Debug Tables

## Overview

The process of migrating ED*Facts* data to the Reports tables automatically creates a set of tables in the debug schema that provide the student IDs that make up the aggregated counts. They are especially useful when doing file comparison and matching work. Those tables can build up over time. This utility provides a means of keeping those tables in check.

### Sample Execution

There are four options for managing the debug tables. Execute the stored procedure using the parameters as follows:

1. Leave both parameters blank and delete ALL tables in the debug schema

```sql
exec [Utilities].[Cleanup_Debug_Tables]
```

2. Pass a reportcode, ex, '002', for @reportCode and delete all the tables in the debug schema for that report (all school years)

```sql
exec [Utilities].[Cleanup_Debug_Tables] '002'
```

3. Pass a 4 digit School Year for @reportYear and delete all the tables in the debug schema for that School Year (all reports)

```sql
exec [Utilities].[Cleanup_Debug_Tables] null, '2022'
```

4. Pass in values for both parameters and delete all the tables for only the specified report for only the specified school year

```sql
exec [Utilities].[Cleanup_Debug_Tables] '002', '2022'
```

### Demonstration

{% embed url="<https://youtu.be/MmfmSMswVFM?t=2335>" %}
Cleanup Debug Tables demo from the Generate 5.3 Office Hour meeting.
{% endembed %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://center-for-the-integration-of-id.gitbook.io/generate-documentation/developer-guides/generate-utilities/cleanup-debug-tables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
