The table does exist and I own it. But I keep getting the following
error:
I don't know what to do. Please help.
statement TRUNCATE TABLE FROM[*] test ; expected identifier; SQL
statement:
truncate table FROM test [42001-63]
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement TRUNCATE
TABLE FROM[*] test ; expected identifier; SQL statement:
truncate table FROM test [42001-63]
at org.h2.message.Message.getSQLException(Message.java:89)
at org.h2.message.Message.getSQLException(Message.java:93)
at org.h2.message.Message.getSyntaxError(Message.java:103)
at org.h2.command.Parser.readIdentifierWithSchema(Parser.java:
2263)
at org.h2.command.Parser.readTableOrView(Parser.java:3906)
at org.h2.command.Parser.parseTruncate(Parser.java:888)
at org.h2.command.Parser.parsePrepared(Parser.java:381)
at org.h2.command.Parser.parse(Parser.java:264)
at org.h2.command.Parser.parse(Parser.java:236)
at org.h2.command.Parser.prepareCommand(Parser.java:208)
at org.h2.engine.Session.prepareLocal(Session.java:173)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:
176)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:97)
at java.lang.Thread.run(Unknown Source)
at org.h2.engine.SessionRemote.done(SessionRemote.java:289)
at org.h2.command.CommandRemote.prepare(CommandRemote.java:54)
at org.h2.command.CommandRemote.<init>(CommandRemote.java:37)
at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:
237)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:
961)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:143)
at org.h2.server.web.WebThread.getResult(WebThread.java:1392)
at org.h2.server.web.WebThread.query(WebThread.java:1054)
at org.h2.server.web.WebThread.process(WebThread.java:375)
at org.h2.server.web.WebThread.processRequest(WebThread.java:131)
at org.h2.server.web.WebThread.run(WebThread.java:158)
It's "TRUNCATE TABLE test". See also
http://www.h2database.com/html/grammar.html#truncate_table
Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
I don't know if this has anything to do with why the database is
complaining of syntax errors. But I clicked yes to abort it and it has
come back again. I am not running any scripts on the database. So I
don't know where this error is coming from.
On Feb 15, 2:37 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
> That is exactly what I type
No, you wrote:
TRUNCATE TABLE FROM test
not
TRUNCATE TABLE test
By the way, consider upgrading to a more recent version of H2. You are
using version 1.0.63.
Regards,
Thomas
truncate table test
Cannot truncate PUBLIC.test [90106-63]
org.h2.jdbc.JdbcSQLException: Cannot truncate PUBLIC.test [90106-63]
at org.h2.message.Message.getSQLException(Message.java:89)
at org.h2.message.Message.getSQLException(Message.java:93)
at org.h2.message.Message.getSQLException(Message.java:71)
at org.h2.command.ddl.TruncateTable.update(TruncateTable.java:30)
at org.h2.command.CommandContainer.update(CommandContainer.java:
64)
at org.h2.command.Command.executeUpdate(Command.java:122)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:
241)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:97)
at java.lang.Thread.run(Unknown Source)
at org.h2.engine.SessionRemote.done(SessionRemote.java:289)
at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:
164)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:155)
at org.h2.server.web.WebThread.getResult(WebThread.java:1392)
at org.h2.server.web.WebThread.query(WebThread.java:1054)
at org.h2.server.web.WebThread.process(WebThread.java:375)
at org.h2.server.web.WebThread.processRequest(WebThread.java:131)
at org.h2.server.web.WebThread.run(WebThread.java:158)
On Feb 15, 2:49 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
Tables with referential integrity constraints can not be truncated.
Also, system tables and view can not be truncated.
See also:
http://www.h2database.com/javadoc/org/h2/constant/ErrorCode.html#c90106
or use the Error Analyzer:
http://www.h2database.com/html/sourceError.html
Regards,
Thomas
select column_name from information_schema.indexes
where table_schema = 'PUBLIC'
and table_name='TEST'
and primary_key
I executed it on my table and since then I have been able to perform
any dml on it. Is there a way to undo this?
On Feb 15, 4:08 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
> > h2-database...@googlegroups.com<h2-database%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/h2-database?hl=en.- Hide quoted text -
>
> - Show quoted text -
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.