问题
I'm trying to create a view on H2SQL, but i cannot find the correct syntax.
I'm using:
CREATE VIEW dbo.Log
AS
SELECT * FROM dbo.MyTable
And i receive the error:
Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "CREATE VIEW DBO.LOG "; expected "COMMENT, (, AS";
What is the right syntax?
回答1:
It's a bug on this version of h2 (1.4.182).
When running a CREATE VIEW from a RUNSCRIPT command, it doesn't handle well the line-breaks (\n) on the file. I resolved adding a comment (--) before each line break.
来源:https://stackoverflow.com/questions/27317144/create-view-on-h2-database