# SQL Server example

This section shows how to set up audit trails for a SQL Server table.

The following Customers table will be used as a writeback destination table.

<div align="left"><img src="/files/-MZCqVw2Dr_T1zAobWKU" alt=""></div>

{% hint style="success" %}
This example assumes that you already have an existing extension using the Customers table as the destination table
{% endhint %}

To enable audit trails for the Customers table:

1\. Create a new table *Customers\_log* with the same structure as the writeback destination table and add the extra auditing columns

<div align="left"><img src="/files/-MZCr-54zRYwY1icmSkE" alt=""></div>

{% hint style="warning" %}
Note that the Id column (customer id) is not a primary key on this table since it will be duplicated on the *Customers\_log* table. If you want to assign an id for each audit row, you can add a RowId column and set it as an identity column.
{% endhint %}

2\. Go to the writeback extension in Qlik sense and enable logs

<div align="left"><img src="/files/-MZD-99y6zu51JdErEHw" alt=""></div>

3\. Enter *Customers\_log* as the Audit log table name

<div align="left"><img src="/files/-MZCuDPsOCjzuWrTsLmS" alt=""></div>

4\. Go to your writeback extension, add a record and click on Save.

<div align="left"><img src="/files/-MZCwn5OvP7MArcpdrPW" alt=""></div>

5\. Edit the existing record and click on Save

![](/files/-MZCxAolRq3Ux07aCsjC)

6\. Open the Customers\_log table

<div align="left"><img src="/files/-MZCxgQ5ne8DZ4TAtYGj" alt=""></div>

As you can see from the Customers\_log screenthost, Qommentary audits all changes made by users.


---

# Agent Instructions: 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:

```
GET https://knowledgebase.qommentary.com/qommentary-writeback/advanced/audit-trails/enable-audit-trails-for-database/sql-server-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
