H2 SQL Server Compatability Mode - "GO" Triggers syntax error

Viewed 16

I am trying to convert the database in our developer desktop environment from a containerized SQL Server to h2 to make our tests run faster. I have configured the h2 database to run in sql server compatibility mode.

Spring application.properties

spring.datasource.url=jdbc:h2:mem:testdb;MODE=MSSQLServer;
spring.datasource.username=sa
spring.datasource.password=password
spring.datasource.driverClassName=org.h2.Driver
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.h2.console.enabled=true

When running our scripts to initialize the database, the word "GO" in the sql script is triggering a syntax error. (simplified script to illustrate error)

create table test_dbo.hello
(
    id               int primary key,
    name varchar(255)
)
GO

insert into test_dbo.hello (id,name) values (1,'World');

H2 complains:

Syntax error in SQL statement

Is there any way to fix this other than eliminating all GO statements from my script?

0 Answers
Related