> 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/file-comparison/run-the-file-comparison.md).

# Run the File Comparison

## Run the File Comparison Utility

The file comparison utility is a stored procedure executed within SSMS. When the file comparison utility is executed, a new table is created containing the results of the comparison. The new “comparison” table contains a row for every record in the Legacy and Generate files. Depending on the file specification, the table may include more details for any mismatched records.

A different procedure will be executed depending on the ED*Facts* file specification to be compared.

### Comparing Directory Files

To compare C029 or C039 files, execute the following:

```sql
exec Utilities.Compare_DIRECTORY 
@DatabaseName = 'Generate', 	-- Your database name 
@SchemaName = 'XX', 		-- Your schema name 
@SubmissionYear = 2022, 		-- The report year
@ReportCode = '029', -- EdFacts File Number – either 029 or 039
@ReportLevel = 'LEA', -- 'SEA', 'LEA', 'SCH' 
@LegacyTableName = 'Generate.XX.029_LEA_2022_Legacy', -- Legacy table
@ShowSQL = 0 
```

### Comparing Discipline Files

To compare 005, 006, 007, 088, 143, or 144 files, execute the following:

```sql
exec Utilities.Compare_DISCIPLINE
@DatabaseName = 'Generate', 	-- Your database name 
@SchemaName = 'XX', 		-- Your schema name 
@SubmissionYear = 2022, 	-- The report year
@ReportCode = '005', -- EdFacts File Number – 005, 006, 007, 088, 143, 144
@ReportLevel = 'LEA', -- 'SEA', 'LEA'
@LegacyTableName = 'Generate.XX.005_LEA_2022_Legacy', -- Legacy table
@ShowSQL = 0
```

### Comparing Child Count Files

To compare 002 or 089 files, execute the following:

```sql
exec Utilities.Compare_CHILDCOUNT 
@DatabaseName = 'Generate', 	-- Your database name 
@SchemaName = 'XX', 		-- Your schema name 
@SubmissionYear = 2022, 		-- The report year
@ReportCode = '089', -- EdFacts File Number – either 002 or 089
@ReportLevel = 'LEA', -- 'SEA', 'LEA', 'SCH' 
@LegacyTableName = 'Generate.XX.C089_LEA_2022_Legacy', -- Legacy table
@ShowSQL = 0
```

### Comparing Exiting Files

To compare 009 files, execute the following:

```sql
exec Utilities.Compare_EXITING
@DatabaseName = 'Generate', 	-- Your database name 
@SchemaName = 'XX', 		-- Your schema name 
@SubmissionYear = 2022, 	-- The report year
@ReportCode = '009', -- EdFacts File Number – 009
@ReportLevel = 'LEA', -- 'SEA', 'LEA' 
@LegacyTableName = 'Generate.XX.009_LEA_2022_Legacy', -- Legacy table
@ShowSQL = 0
```

### Comparing All Other Files

To compare other ED*Facts* files, execute the following:

```sql
exec Utilities.CompareSubmissionFiles 
@DatabaseName = 'Generate', 	-- Your database name 
@SchemaName = 'XX', 		-- Your schema name 
@SubmissionYear = 2022, 		-- The report year
@ReportCode = '005', -- EdFacts File Number
@ReportLevel = 'LEA', -- 'SEA', 'LEA', 'SCH' 
@LegacyTableName = 'Generate.XX.005_LEA_2022_Legacy', -- Legacy table
@GenerateTableName = 'Generate.XX.005_LEA_2022_Generate', -- Generate table
@ShowSQL = 0, 
@ComparisonResultsTableName = NULL
```


---

# 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/file-comparison/run-the-file-comparison.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.
