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

'sp_addsubscription' cannot be executed within a transaction. #2175

seb-urbaniak opened this issue Oct 17, 2018 · 3 comments

'sp_addsubscription' cannot be executed within a transaction. #2175

seb-urbaniak opened this issue Oct 17, 2018 · 3 comments


Copy link

Which version and edition of Flyway are you using?

Flyway Community Edition 5.2.0 by Boxfuse

If this is not the latest version, can you reproduce the issue with the latest one as well?

I think we are on the latest v, if not - very close to it.

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


Which database are you using (type & version)?

Microsoft SQL Server Enterprise 64-bit (v14.0.3037.1)

Which operating system are you using?

Microsoft Windows 10 Enterprise 64bit (v10.0.17134)

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.)

Defined afterMigrate.sql, with a
"exec sp_addsubscription @Publication ="
command in it.
Profile is using:

What did you expect to see?

Clean execution.

What did you see instead?

Executing SQL callback: afterMigrate
ERROR: Error while executing afterMigrate callback:
Migration afterMigrate.sql failed

SQL State : S0001
Error Code : 15002
Message : The procedure 'sp_addsubscription' cannot be executed within a transaction.

Could I suggest that a new flag is introduced in the profile, which would let me toggle if (or which) before or after Migrate callback scripts are executed within the TRAN BEGIN-COMMIT wrapper or NOT ?

Copy link

Ahhh very interesting! And there is zero documentation about this limitation on Microsoft's website! Fixed.

Please open additional issues if you find other procedures affected by this.

Copy link

Fix confirmed! Now works great. Vielen Dank Axel. (will log a somewhat related issue for beforeMigrate callback)

Copy link

sluraf commented Aug 22, 2023

I have te same exception on sp_addlinkedsrvlogin is it fixed too in new version ?

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

No branches or pull requests

3 participants