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 Specifying Properties in a Connection Profile. 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: All commands and parameters use the --kebab-case format in the CLI environment. This is the format Liquibase recommends for best results. If your preference is camelCase, it will still work in the CLI.




--changelog-file *

Specifies the root changelog



Specifies the JDBC database connection URL



Specifies the database username



Specifies the database password


--output-file **

Specifies the file path to where the update-count SQL 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


The integer indicating the number of changes you want to update