# Using rollback with formatted SQL

**URL:** <https://forum.liquibase.org/t/using-rollback-with-formatted-sql/2731>\
**Category:** General Discussion\
**Created:** [October 24, 2013, 8:49pm UTC](https://forum.liquibase.org/t/using-rollback-with-formatted-sql/2731 "2013-10-24T20:49:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kk1](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@kk1](https://forum.liquibase.org/u/kk1)\
**Post date:** [October 24, 2013, 8:49pm UTC](https://forum.liquibase.org/t/using-rollback-with-formatted-sql/2731/1 "2013-10-24T20:49:00Z")

</div>

Hello,

I am trying to test the rollback feature with formatted SQL. I am getting this error,

**Liquibase Update Failed: rollbackSQL requires a rollback tag**

Naturally, this being SQL, I do not have rollback tag, though, I do have rollback specfied (as suggested in the docs) as,

–rollback drop table my\_table;

Would appreciate some advice.

Thanks

---

<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:** [October 24, 2013, 8:49pm UTC](https://forum.liquibase.org/t/using-rollback-with-formatted-sql/2731/2 "2013-10-24T20:49:00Z")

</div>

The rollback definition should look like this:

–changeset nvoxland:1

create table test1 (

&nbsp; id int not null primary key,

&nbsp; name varchar(255)

);

–rollback

delete from test1;

---

<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:** [October 24, 2013, 8:49pm UTC](https://forum.liquibase.org/t/using-rollback-with-formatted-sql/2731/3 "2013-10-24T20:49:00Z")

</div>

Hello, thanks for the reply.

I tried what you suggested. But If I put the rollback statement on it’s own (like you suggested), it’s being executed along with the main SQL.

So, If I had a file like this,

–liquibase formatted sql

–changeset change:1

create table table\_1 (

&nbsp; &nbsp; id int primary key,

&nbsp; &nbsp; name varchar(255)

);

–rollback &nbsp;

drop table table\_1;

–changeset change:2

insert into table\_1(id, name) values (1, ‘name 1’);

insert into table\_1(id, name) values (2, ‘name 2’);

–rollback

delete from table\_1 where id = 1;

delete from table\_1 where id = 2;

The first changeset & rollback are executing one after the other and the change:2 set fails, as the previous rollback has dropped the table already.

Is my syntax wrong some where or am I missing a piece of config somewhere ?

Regards

---

<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:** [October 24, 2013, 8:49pm UTC](https://forum.liquibase.org/t/using-rollback-with-formatted-sql/2731/4 "2013-10-24T20:49:00Z")

</div>

Could you run with logLevel=debug and send the output?  
  
Nathan
