Create view on h2 database

心已入冬 提交于 2019-12-24 04:48:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!