Using SQL database modeling tool to create and update a database

Applies to

ApexSQL Model

Summary

This article explains how to create and update a database using ApexSQL Model.

Description

ApexSQL Model is a SQL database modeling tool that has the ability to create and modify tables, create new databases or modify existing ones. In this article, methods of how to create and update a database will be described in detail.

Create a database

To start creating a new database, start ApexSQL Model, click on the New button from the Home tab. When the New button is clicked, the main blank window will be shown:

ApexSQL Model SQL database modeling tool

Create a table

ApexSQL Model offers a very easy way to create tables. To add a new table, right-click anywhere on the main diagram, and from the right-click context menu, click on the Add table button:

Create table using ApexSQL Model

The Add table window will be opened. In here, Name of the table can be given and Schema type can be chosen, along with other options such as add/delete/edit Columns, create Constraints and Indexes can be created:

Constraints and indexes can be created

When table properties are configured and the OK button is clicked, the new table will be created as shown below:

Free SQL database modeling tool used to create a table

The same table can be edited and updated by right-clicking on the table and choosing the Edit option from the context menu:

Edit table with ApexSQL Model

The Edit table window will appear:

Edit table window

When objects are created, it’s time for creating a database. To do this, go to the Actions tab and click on the Create database button:

Create a database using a free SQL database modeling tool

Crate database window will be opened. From the Server drop-down menu, select targeted SQL Server on which database from the model will be created:

Crate database window

From the Authentication drop-down menu, choose the type of Authentication.

The authentication methods are as follows:

  • Windows
  • SQL Server
  • Active Directory Password
  • Active Directory Integrated
  • Active Directory Universal with MFA support

Crate database using ApexSQL Model

Enter the database name, select Collation and Compatibility level from the drop-down menu:

A database can be created using a free SQL database modeling tool

Once when Execute now button is clicked, creating a database process will be started.

Progress will be shown in the pop-up dialog:

Creating database process

The info message will be shown when the database is created:

Successfully created database free modeling tool

This is an example of the created database shown in the SQL Server Management Studio:

Custom database made in the free SQL data modeling tool

Update database

Requirements

ApexSQL Model uses ApexSQL Diff for updating a database. This tool must be installed locally.

Updating the database process is similar to creating one. The database can be loaded, and then new tables can be added, or existing ones can be edited.

To load a database, click on the Create model button from the Actions tab:

Crate database using ApexSQL Model

When the Create model window is opened, from the Source drop-down, select Database as the Source, the targeted Server instance, type of Authentication, and from a Database drop-down menu, select the wanted database:

Update database window

When the database is loaded, after creating new objects or editing existing ones, the database can be updated by clicking the Update database button from the Actions tab:

Updating database using SQL database model tool

In the Update database window, click on the Execute now button to update the database:

update database

A database can be updated without previously loading it. To do that, start ApexSQL Model, click the Add new table button, add new tables, and then click the Update database button:

Update database

From this point on, the updating process is the same as in the previous case. Specify SQL Server and the database for the update and click the Execute now button.

This is an example of a created database using SQL database modeling tool:

Free modeling tool to create database