---
title: "Define database SQL hook"
id: "define-database-sql-hook"
project: "EHR User Guide"
url: "https://help.cloud5.com.au/articles/ehr-user-guide/define-database-sql-hook"
updated: 2026-10-19T00:54:20Z
---

# Define database SQL hook

When defining a form template field, selecting **h**(Database SQL Hook) as the **Data Type**allows you to enter SQL statements for EmpowerHR to run and then display the results in the form.

You should limit the SQL to return only a single column and row. If more than one column or row is produced, EmpowerHR displays a warning message with the results.

## Display format options explained

The **h** (Database SQL Hook) field has different Display Format rules than other fields. Here they are explained:

| **Display Format** | **Explanation** |
| --- | --- |
| c | Display the value as a character string with no formatting |
| d | Display the value as a date |
| fx.y | Display the value as a number with x digits before, and y digits after, the decimal point.<br><br>x and y are numbers between **0** (zero) and **9**. |
| m | Display the value as a monetary amount. |
| r | Display the value as a rate. |

See [SQL for self service forms](/smart/project-ehr-technical-user-guide/sql-for-self-service-forms) in the EHR Technical User Guide ![](/resources/Storage/ehr-user-guide/icons/info%20icon%20-%20small.png) for examples of SQL statements and tags.
If you don't have access to the EHR Technical User Guide, you can log an [iHelp request](https://infusion.fusion5.com/) and we will provide login credentials to you.

| Next topic<br><br>[Define table field](/articles/ehr-user-guide/define-table-field) |
| --- |

© 2023 Fusion5. All rights reserved.