> For the complete documentation index, see [llms.txt](https://docs.keyfax.biz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keyfax.biz/product-suite/admin/best-practices/extracting-xml-from-keyfax-tables.md).

# Extracting XML from Keyfax tables

We are often asked, particularly by integration engineers, how to access information relating to **Startup** or **Export** data. Typically, data is held in XML documents which can be difficult to read. Using SQL Server Management Services (SSMS) it is possible to view either **Session** or **History** data.

### Session Data

Here we are looking at session data from the **seSessionValues** table. Other tables holding XML content are syOrder (repair orders) and syTaskHistory (repairs and enquiries).

To retrieve the latest **Startup XML** the following provides clickable links.

```sql
SELECT DateTime, GUID, Name, CONVERT(xml, REPLACE(CAST(Data AS NVARCHAR(MAX)), ' encoding="utf-8"', ''))
FROM seSessionValues WITH (NOLOCK)
WHERE Name = 'Startup'
ORDER BY DateTime DESC
```

Run the results into a Grid and the hyperlinks will be presented; clicking each will open the formatted XML document in a new tab:

<div align="left"><figure><img src="/files/aUbRw6yt2EO9dBrJiCDL" alt=""><figcaption><p>seSessionValues sample data</p></figcaption></figure></div>

**Export XML** can be extracted as follows:

```sql
SELECT DateTime, GUID, Name, CONVERT(xml, REPLACE(CAST(Data AS NVARCHAR(MAX)), ' encoding="utf-8"', ''))
FROM seSessionValues WITH (NOLOCK)
WHERE Name = 'EXPORT_XML'
ORDER BY DateTime DESC
```

### History Data

Depending on your configuration, this will involve two main tables **syOrders** and **syTaskHistory**:

```sql
SELECT * FROM syOrder WITH (NOLOCK) ORDER BY Created DESC
 or
SELECT * FROM syTaskHistory WITH (NOLOCK) ORDER BY Created DESC

```
