Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Server: error parsing string literals starting with 'as' #2060

Closed
UriHendler opened this issue Jun 28, 2018 · 1 comment
Closed

SQL Server: error parsing string literals starting with 'as' #2060

UriHendler opened this issue Jun 28, 2018 · 1 comment

Comments

@UriHendler
Copy link

@UriHendler UriHendler commented Jun 28, 2018

Which version and edition of Flyway are you using?

5.1.3 Community Edition

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

command-line

Which database are you using (type & version)?

SQL Server 2014

Which operating system are you using?

Windows 10

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
I'm trying to run the attached migration.
V1_4__Initial_create_functions_and_procs_4.txt

I get the error "Incorrect syntax near 'GO'".
Is this issue connected to #2011?

The parser seems to be confused by the contents of the "exists ()" starting on line 55. If I change line 55 of the migration to if exists (select 1) begin the migration runs correctly.
Alternatively, if I remove from line 142 to the end of the file, it also runs correctly.
I haven't managed to narrow it down any further.

I have tried running flyway-commandline from the source code (in the master branch) and the problem still exists.

Command line:
..\flyway-5.1.3\flyway.cmd -configFiles="C:\Source\Databases\DatabaseProcsAndScripts\Migrations\flyway_migrate.conf" migrate

Config:
flyway.url=jdbc:sqlserver://localhost;databaseName=testmigrations;integratedSecurity=true
flyway.mixed=false
flyway.locations=filesystem:C:\Source\Databases\DatabaseProcsAndScripts\Migrations

What did you expect to see?

The migration runs successfully.

What did you see instead?

An error message: Incorrect syntax near 'GO'.

2018-06-28 13:46:10.105 ERROR : Migration V1_4__Initial_create_functions_and_procs_4.sql failed
SQL State : S0001
Error Code : 102
Message : Incorrect syntax near 'GO'.
Location : C:\Source\Databases\DatabaseProcsAndScripts\Migrations\V1_4__Initial_create_functions_and_procs_4.sql (C:\Source\Databases\DatabaseProcsAndScripts\Migrations\V1_4__Initial_create_functions_and_procs_4.sql)
Line : 8

@axelfontaine axelfontaine added this to the Flyway 5.1.4 milestone Jun 28, 2018
@axelfontaine axelfontaine changed the title SQL Server: Incorrect syntax near 'GO' SQL Server: error parsing string literals starting with 'as' Jun 28, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jun 28, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jun 28, 2018

Good catch and thanks for beginning to narrow it down. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants