Create custom database using AddIn.sql failed with SQL error

SOLVED

Hi all,

I want to create a custom database using addIn.sql file from an Add on, so user do not have to go to MSSQL to create himself. But I have problem installing the add on because of this error:

"CREATE DATABASE statement not allowed within multi-statement transaction" which were printed twice.

Below are my create SQL query: (I would like to paste it as "Code" but unable to do so because of "You have been blocked" popup). I have try execute it in MSSQL Studio and the query is working fine.

  • +1
    verified answer

    The Execute method of Sage.MMSAdmin.DBEngine.SQL.Extensions.ExtensionStrategy which is responsible for running any 3rd party SQL scripts wraps everything in an ambient transaction - so this means that any non-transactionable commands (such as CREATE DATABASE) will fail - even when you specify autocommit mode (which you're doing with SET IMPLICIT_TRANSACTIONS OFF).