# sqlFile tag not expanding placeholders

**URL:** <https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564>\
**Category:** General Discussion\
**Created:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564 "2010-06-23T08:50:00Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben\_lb](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@ben\_lb](https://forum.liquibase.org/u/ben_lb)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/1 "2010-06-23T08:50:00Z")

</div>

Hi,

I have the following bit of code in a file schema.sql:

 IF EXISTS ( SELECT \* FROM sys.objects WHERE object\_id = OBJECT\_ID(N'[${cmuser}].[ms\_schema\_create\_site]') AND type in (N'P', N'PC') ) DROP PROCEDURE [${cmuser}].[ms\_schema\_create\_site]

When this schema.sql file is run via a sqlFile tag - the ${variable} placeholders are not expanded. This works OK in a sql tag. Are there any plans on supporting placeholder expansing with sqlFile tag files? We use placeholders extensively for our scripts - and it would be unfortunate to have to paste them all into sql tags.

Thanks,

Ben

I’m on a 2.0 RC2 build.

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/2 "2010-06-23T08:50:00Z")

</div>

It’s not something I had thought of, but it may be a good idea. I’ve generally thought of the included .sql files as files that would normally be ran against a database but are being managed by liquibase instead of directly, and if you add ${} blocks, your SQL will not execute on it’s own outside of liquibase.&nbsp; That may be OK, though, since you would only put them in if you are using liquibase.&nbsp;

I’ll add it as a feature for 2.1.&nbsp;

Nathan

---

<div class="post-metadata">

**Author:** ![ben\_lb](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@ben\_lb](https://forum.liquibase.org/u/ben_lb)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/3 "2010-06-23T08:50:00Z")

</div>

That’d be great thanks.

The reason I’m hitting it is that I’m porting all our legacy SQL scripts over - many of which make use of Oracle sqlplus’s $1 parameter functionality and MS SQL Server sqlcmd’s $(variable) parameter substitution. Some of these scripts cannot easily be moved into containing tags.

Ben

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/4 "2010-06-23T08:50:00Z")

</div>

Those may be OK still.&nbsp; The variable substitution will only look for ${}'s so oracle will be OK.&nbsp; It will also keep ${} variables it doesn’t recognize as their original value, so it will probably work with sqlserver as well, depending on if there is any overlap between your liquibase and sqlserver variable names.

Nathan

---

<div class="post-metadata">

**Author:** ![ianbrandt](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@ianbrandt](https://forum.liquibase.org/u/ianbrandt)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/5 "2010-06-23T08:50:00Z")

</div>

[http://liquibase.jira.com/browse/CORE-641](http://liquibase.jira.com/browse/CORE-641 "CORE-641")

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/6 "2010-06-23T08:50:00Z")

</div>

This seems to be buggered again in 3.0.7 - placeholders are not being replaced in included sqlFile’s.

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/7 "2010-06-23T08:50:00Z")

</div>

I reopened the bug and will look at it with 3.0.8. Thanks

Nathan

---

<div class="post-metadata">

**Author:** ![un1388145494790r68id](https://avatars.discourse-cdn.com/v4/letter/u/e68b1a/32.png) [@un1388145494790r68id](https://forum.liquibase.org/u/un1388145494790r68id)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/8 "2010-06-23T08:50:00Z")

</div>

Hi,

With version 3.0.8, it tried to replace :&nbsp;

1.

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/9 "2010-06-23T08:50:00Z")

</div>

There was a fix for some places, but no in sqlFile. That is now in the upcoming 3.1.0 release which should be out today or tomorrow.

Nathan

---

<div class="post-metadata">

**Author:** ![un1405044996144r45id](https://avatars.discourse-cdn.com/v4/letter/u/d6d6ee/32.png) [@un1405044996144r45id](https://forum.liquibase.org/u/un1405044996144r45id)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/10 "2010-06-23T08:50:00Z")

</div>

Hi

I tried parameter replacement in 3.2.0 against oracle and it didn’t work for .

It did work for .

This is the command line I’m using

java -DchangeId=1405045580= -jar …/…/…/standaloneCmdLineExample/liquibase-3.2.0-bin/liquibase.jar --defaultsFile=./liquibase.properties --changeLogFile=./simpleSQLFileExamplechangelogfile.xml update

This is the change log file

\<?xml version="1.0" encoding="UTF-8"?\>

\<databaseChangeLog xmlns=“[http://www.liquibase.org/xml/ns/dbchangelog](http://www.liquibase.org/xml/ns/dbchangelog)” xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)” xsi:schemaLocation="[http://www.liquibase.org/xml/ns/dbchangelog](http://www.liquibase.org/xml/ns/dbchangelog)

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd](http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd)"\>

&nbsp; &nbsp; &nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![un1402585160903r22id](https://avatars.discourse-cdn.com/v4/letter/u/ee59a6/32.png) [@un1402585160903r22id](https://forum.liquibase.org/u/un1402585160903r22id)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/11 "2010-06-23T08:50:00Z")

</div>

Yes, I’ve noticed this as well, but nobody has responded.

&nbsp;

[http://forum.liquibase.org/topic/sqlfile-property-replacement-in-3-2-0](http://forum.liquibase.org/topic/sqlfile-property-replacement-in-3-2-0)

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [June 23, 2010, 8:50am UTC](https://forum.liquibase.org/t/sqlfile-tag-not-expanding-placeholders/564/12 "2010-06-23T08:50:00Z")

</div>

Sorry for the slow response, but it has been fixed for 3.2.1. That release should hopefully be out today.

Nathan
