# Using Liquibase to execute dynamic SQL queries with property files

**URL:** <https://forum.liquibase.org/t/using-liquibase-to-execute-dynamic-sql-queries-with-property-files/8151>\
**Category:** Liquibase Development\
**Created:** [April 27, 2023, 7:03pm UTC](https://forum.liquibase.org/t/using-liquibase-to-execute-dynamic-sql-queries-with-property-files/8151 "2023-04-27T19:03:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![codabat](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@codabat](https://forum.liquibase.org/u/codabat)\
**Post date:** [April 27, 2023, 7:03pm UTC](https://forum.liquibase.org/t/using-liquibase-to-execute-dynamic-sql-queries-with-property-files/8151/1 "2023-04-27T19:03:50Z")

</div>

Hi everyone,  
I’ve recently started using Liquibase and so far, I’m impressed with it. Currently, I’m using it in formatted SQL mode (–liquibase formatted SQL), and it’s working great for me. However, I’ve been running into some issues when trying to execute INSERT queries where the values are not known at the time of code writing but only at deployment time.

To solve this problem, I created a properties file with two variables, and I’d like to use them through Liquibase’s API to execute a query like the following:

–changeset user1:4  
–precondition (tableExists tableName: application\_properties)  
INSERT INTO application\_properties (k, v) VALUES (${path}, ${nameDb});

The ‘path’ and ‘nameDb’ variables are retrieved from a properties file. I would really appreciate it if someone could help me understand how to achieve this. I’ve tried going through the documentation, but I haven’t been able to figure it out.

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![PJatLiquibase](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@PJatLiquibase](https://forum.liquibase.org/u/PJatLiquibase)\
**Post date:** [May 18, 2023, 6:53pm UTC](https://forum.liquibase.org/t/using-liquibase-to-execute-dynamic-sql-queries-with-property-files/8151/2 "2023-05-18T18:53:48Z")

</div>

Hi @codabat,

There’s an overview of substituting properties in the documentation here → [Substituting Properties in Changelogs](https://docs.liquibase.com/concepts/changelogs/property-substitution.html)

How you set them will depend on how you are calling liquibase. There are different combinations based on what makes sense for you. For example, from the Liquibase CLI you would do the following:

> `-Dpath=my/path -DnameDb=myname`

Does that help?

`-PJ`
