> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Making Sense of SQLOUT.TXT
- URL: https://nolongerset.com/making-sense-of-sqlout-txt/
- Published: 2022-03-09T06:47:11.000Z
- Updated: 2026-05-08T12:59:12.000Z
- Description: You've enabled ODBC Trace SQL Mode and created a sqlout.txt file. But do you know what to do with it now? Let's explore.
- Author: Mike Wolfe
- Tags: SQL Server, Debugging, #Import 2026-05-20 02:59

If you want to trace ODBC commands from Access, there are three steps:

1. [Enable ODBC Trace SQL Mode in the registry](https://nolongerset.com/procmon-troubleshoot-registry-calls/)
2. [Find and open the sqlout.txt file](https://nolongerset.com/finding-sqlout-txt/)
3. Make sense of what you see in `sqlout.txt` (read on!)

## Overview of `SQLOUT.TXT`

The contents of `sqlout.txt` are a less detailed version of [what you would see using XEvent Profiler in SSMS](https://nolongerset.com/how-access-reads-data-from-sql-server/). Here's a screenshot of one of my `sqlout.txt` files:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/03/image-30.png)

Notice a few things about this screenshot:

- There is a blank line separating each entry
- Each line begins with an [ODBC function](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/odbc-api-reference?view=sql-server-ver15): `SQLPrepare`, `SQLExecute`, `SQLExecDirect`, etc.
- `SQLExecute` lines include an explanatory note:  
 • `(GOTO BOOKMARK)`  
 • `(MULTI-ROW FETCH)`  
 • etc.
- `SQLPrepare` and `SQLExecDirect` lines include the T-SQL passed to SQL Server
- T-SQL statements contain question marks (`?`) as parameter placeholders
- The value of the parameters is not logged in `sqlout.txt`

### SQLPrepare

From the [documentation](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlprepare-function?view=sql-server-ver15):

> **SQLPrepare** prepares an SQL string for execution.

If Access will be executing the same query more than once, it starts by calling the SQLPrepare function so SQL Server can build and save a query plan for future use.

### SQLExecute

From the [documentation](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlexecute-function?view=sql-server-ver15):

> **SQLExecute** executes a prepared statement, using the current values of the parameter marker variables if any parameter markers exist in the statement.

The SQLPrepare statement does not return data from the database; it only creates the query plan. Running SQLExecute retrieves data using a previously compiled query plan.

In practice, the SQLPrepare and SQLExecute *ODBC* *functions* are often executed on SQL Server using the [sp\_prepexec stored procedure](https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-prepexec-transact-sql?view=sql-server-ver15), which combines the two functions into a single statement.

#### SQLExecute: (GOTO BOOKMARK)

This line represents Access **requesting a single record** from a prepared query.

#### SQLExecute: (MULTI-ROW FETCH)

This line represents Access **requesting multiple records** (batches of ten, usually) from a prepared query.

Every ODBC request carries a certain amount of overhead. Pulling multiple records at a time reduces the total overhead versus pulling them one at a time. Generally speaking, large blocks of `(MULTI-ROW FETCH)` lines will perform better than large blocks of `(GOTO BOOKMARK)` lines.

Remember:

- `(GOTO BOOKMARK)`: **one** record retrieved
- `(MULTI-ROW FETCH)`: **ten** records retrieved

If you are seeing large blocks of `(GOTO BOOKMARK)` lines, you may be suffering from the *[empty RecordSource bug](https://codekabinett.com/rdumps.php?Lang=2&targetDoc=access-odbc-recordsource-disables-multi-row-fetch-continuous-form)* that Access MVP Philipp Stiefel identified.

### SQLExecDirect

From the [documentation](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlexecdirect-function?view=sql-server-ver15):

> **SQLExecDirect** executes a preparable statement, using the current values of the parameter marker variables if any parameters exist in the statement. **SQLExecDirect** is the fastest way to submit an SQL statement for one-time execution.

If Access only needs to execute a query once, it will use the SQLExecDirect function. This is used for things like inserting or deleting a single record, as well as retrieving an entire table's worth of unique index values to aid in form navigation (with multi-row fetch used to retrieve all requested field values for just the visible rows in a continuous form).

#### SQLExecDirect: SELECT IDENT\_CURRENT()

[This statement](https://docs.microsoft.com/en-us/sql/t-sql/functions/ident-current-transact-sql?view=sql-server-ver15) gets called immediately after a record gets inserted on a table with an autonumber column. 

> Returns the last identity value generated for a specified table or view. The last identity value generated can be for any session and any scope.

Note in the documentation quoted above, the value returned is for ***any session*** and ***any scope***. Thus, in an environment with a lot of inserts (or just really bad luck), it's possible for this function to return the wrong value.

## Further reading

Long-time Access MVP Ben Clothier recently wrote an excellent [six-part series on ODBC tracing](https://accessexperts.com/odbc/):

1. [Why should we trace ODBC? How will it help me?](https://accessexperts.com/blog/2021/12/15/access-odbc-data-sources-part-1/)
2. [What’s Access doing when we browse and look at records in a ODBC linked table?](https://accessexperts.com/blog/2021/12/16/access-odbc-data-sources-part-2/)
3. [How does Access choose a key for sorting and selecting?](https://accessexperts.com/blog/2021/12/17/access-odbc-data-sources-part-3/)
4. [What’s Access doing when a user makes changes to data on an ODBC linked table?](https://accessexperts.com/blog/2021/12/18/access-odbc-data-sources-part-4/)
5. [Filtering the recordset](https://accessexperts.com/blog/2021/12/19/access-odbc-data-sources-part-5/)
6. [Effect of joins in a recordset](https://accessexperts.com/blog/2021/12/20/access-odbc-data-sources-part-6/)

---

### External references

[ODBC Function Summary - ODBC API ReferenceODBC Function SummaryMicrosoft DocsDavid-Engel![](https://docs.microsoft.com/en-us/media/logos/logo-ms-social.png)](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/odbc-function-summary?view=sql-server-ver15)

[Setting the Recordsource at runtime disables ODBC Multi-Row-Fetch for continuous formThis super esoteric issue might be a factor when you experience lagging screen updates in your continuous form bound to an ODBC table from an SQL Server on Azure.![](https://codekabinett.com/images/favicon.png)CodekabinettPhilipp Stiefel![](https://codekabinett.com/images/mvp_hor.png)](https://codekabinett.com/rdumps.php?Lang=2&targetDoc=access-odbc-recordsource-disables-multi-row-fetch-continuous-form)

### Referenced articles

[Using ProcMon to Troubleshoot Registry CallsFinding the correct registry keys for JetShowPlan and ODBC TraceSqlMode can be tricky. Let ProcMon take the guesswork out of the process.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/02/needle-1419606_1920.jpg)](https://nolongerset.com/procmon-troubleshoot-registry-calls/)

[3 Ways to Find sqlout.txtFinding ODBC TraceSQLMode’s sqlout.txt file can be deceptively difficult. Here are three approaches to make it easy. At least one is guaranteed to work.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/03/Finding-Sqlout.txt.jpg)](https://nolongerset.com/finding-sqlout-txt/)

[How Access Reads Data From SQL ServerHow does Microsoft Access pull data from SQL Server? You’ll be amazed when we pull back the curtain to expose how Access interacts with SQL Server.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/02/data-2899900_1920.jpg)](https://nolongerset.com/how-access-reads-data-from-sql-server/)

*Image by [Augusto Ordóñez](https://pixabay.com/users/paligraficas-6638487/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=6326312) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=6326312)*