To generate SQL scripts from your SQL Server project click the SQL Script icon on the main toolbar. New modal opens. Click Save Script and select a location where the file should be stored.
![ER diagram for SQL Server - SQL script generated by Luna Modeler](https://www.datensen.com/blog/wp-content/uploads/sql-server-script-from-diagram.webp)
Generation settings
You can control how the script will be generated on the Generation settings tab
![Script generation settings in Luna Modeler - data modeling tool for SQL Server](https://www.datensen.com/blog/wp-content/uploads/sql-server-script-generation-settings.png)
Order of items
The order in which the objects will be in the resulting SQL script can be modified on the Order items tab. You can easily change the order or click the Reset order button to automatically rearrange the positions of objects.
![Order items](https://www.datensen.com/blog/wp-content/uploads/order-items.png)
Option Overwrite existing files allows you to ignore existing scripts and overwrite them without getting a warning.
#