Generating the script
Here is a step by step guide to generate an sql script to re created a database in SQL Server using SQL Server Management Studio (SSMS). This can be used to copy the database structure and contents, or for backups.- Right click the database to be the source of the script, select "Tasks", select "Generate Scripts.."
- Select specific objects to be included, else select "Script entire database and all database objects" radio button.
- The default is to generate the schema only, if data is required as well/instead of then select advanced options and alter "Types of data to script" to the desired setting.
- Set desired location to save the script and click next
- Review the settings to be used and click next
You now have an SQL script to recreate your database.
Restoring the database
To create your database from the SQL script simply select File -> Open -> File, select the script.
From the toolbar click execute
The database should be be fully restored.