Create database on MSSQL through Scripting

Hello all
I have been making a script in Igntion that runs on project save. It is to verify the database structure against a passed in structure, so that changes can be made in ignition rather than having to open management studio.

I have all of the required functions working except for one. This is the ability to create a new connection AND new database entry on a preconfigured driver. For example, if connection name “LOCALMSSQL” is not the default connection, it will use the supplied driver name, username, and password along with the searched for connection name to create a new connection. This works sing system.db.addDatasource()

I then want the ability to add database to the database server that LOCALMSSQL connects to. For example connection.addDatabase(“project1”) or some equivalent. It could be part of the addDatasource as well.

Is there anything currently that does this, or is management studio still required to make the initial database?

Looks like you just need to issue a well formed SQL statement.

Thank you for your help. I managed to get the connection to work and create a database inside it. Is there a way to set the Extra Connection Properties from scripting except to drop and readd the connection?