# Customize generated SQL from an XML changeset

**URL:** <https://forum.liquibase.org/t/customize-generated-sql-from-an-xml-changeset/6086>\
**Category:** Community Content and Articles\
**Created:** [October 27, 2021, 3:05pm UTC](https://forum.liquibase.org/t/customize-generated-sql-from-an-xml-changeset/6086 "2021-10-27T15:05:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/liquibase1/original/2X/8/81af1ada55fb9198255cebbe394fd74740dc1429.png) [@system](https://forum.liquibase.org/u/system)\
**Post date:** [October 27, 2021, 3:05pm UTC](https://forum.liquibase.org/t/customize-generated-sql-from-an-xml-changeset/6086/1 "2021-10-27T15:05:54Z")

</div>

Originally published at: [Customize generated SQL from an XML changeset | Liquibase.com](https://www.liquibase.com/blog/customize-generated-sql-xml-changeset)

Sometimes you need to modify SQL in specific _changesets_ and you still want to use the abstracting power of XML to make your change database agnostic. Although Liquibase supports most standard SQL statements with [change types](https://docs.liquibase.com/change-types/home.html), there are situations when the generated SQL needs to be modified for your particular needs. To accommodate this, Liquibase offers a very useful tag: [\<modifySql\>](https://docs.liquibase.com/workflows/liquibase-community/modify-sql.html).

## Scenario

You need to create a table using an XML _changeset_ for a specific [filegroup](https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-files-and-filegroups?view=sql-server-ver15) on SQL Server.

**Problem:** The XML _changeset_ does not offer a filegroup attribute.  
**Solution:** Use the handy `\<modifySql\>` tag!

### Example

Let’s use the `<modifySql>` tag to append the string: “ON FileGroup\_Name”.

```
<changeSet author="SteveZ" id="159-CreateTable_salesTable2">
    <createTable tableName="salesTable2">
        <column name="ID" type="int">
                       <constraints nullable="false"/>
        </column>
               <column name="NAME" type="varchar(20)"/>
                  <column name="REGION" type="varchar(20)"/>
               <column name="MARKET" type="varchar(20)"/>
        </createTable>
        <modifySql dbms="mssql">  
                 <append value=" ON FileGroupName"/>  
        </modifySql>            
</changeSet>
```

Notice that the **dbms=mssql** attribute ensures that this `\<modifySql\>` tag will only apply to the SQL Server database platform.&nbsp;

Now you have generated a SQL statement that includes the table within the desired filegroup!

Simply run the `liquibase updateSQL` command to verify the generated SQL and conduct a quick code review.

```
-- Changeset changeLog.xml::159-CreateTable_salesTable2::SteveZ
CREATE TABLE salesTable2 (ID int NOT NULL, NAME varchar(20), REGION varchar(20), MARKET varchar(20)) ON FileGroupName
GO
```

Once the generated SQL is confirmed and is ready to be deployed, run the `liquibase update` command to apply the changes.
