• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java DB - Delete all records in a table.

 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
Can anyone please tell me how do i delete all the records in a table with a single query?
I am using Squirrel SQL client for databases.
I tried using -> truncate table table_name;
but it is'nt working.

Thanks in advance!
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using delete from tablename?
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swastik Dey wrote:How about using delete from tablename?


Hey Thanks Swastik, it worked!
but i want to restore the auto-increment primary key after deleting all records, that's why i was using truncate. how do we do this in java DB?
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats going wrong with truncate?
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ash neet wrote:...I tried using -> truncate table table_name;
but it is'nt working.
...
What happens?
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan Cumps wrote:
ash neet wrote:...I tried using -> truncate table table_name;
but it is'nt working.
...
What happens?


it gives me the following error when i use the syntax - "truncate table table_name"
Error: Feature not implemented: truncate table.
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to be a bug in java db
http://www.talendforge.org/forum/viewtopic.php?id=784
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swastik Dey wrote:This seems to be a bug in java db
http://www.talendforge.org/forum/viewtopic.php?id=784


Thanks! i will upgrade my java db.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic