The update-count-sql command is a helper command that inspects the SQL Liquibase will run while using the update-count command.


The update-count-sql command is used to inspect the raw SQL before running the update-count command, so you can correct any issues that may arise before running the command. Liquibase uses the raw SQL to apply a specified number of database changes you have added to the changelog file.

Running the update-count-sql command

To run the update-count-sql command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Create and Configure a liquibase.properties File. You can also specify properties from the command line.

Then run the update-count-sql command:

liquibase --changelog-file=changelog.xml update-count-sql 2

Note: Enter the name of the changelog and the number that you want to use in place of changelog.xmland 2.

update-count-sql global attributes

Tip: For best results, specify all commands and parameters in the --kebab-case format in the CLI. If your preference is camelCase, it also works in the CLI.

Attribute Definition Requirement
--changelog-file *

The root changelog


The JDBC database connection URL


The database username


The database password

--output-file **

Specifies the file path to where the SQL output will be written


*Liquibase checks the changelog and any nested changelogs for the definitions of the changeset to update.

** If not specified, the update-count-sql output goes to STDOUT.

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.

update-count-sql command attributes

Attribute Definition Requirement

Integer specifying how many changes Liquibase applies the command to