sql server database dump for backup and restore step by step
There are probably more ways to do this but I usually right-click the database and choose “Tasks → Back up…” with Backup type “Full”. After that you can copy the created file to your target machine, connect to its SQL Server in SQL Server Management Studio, right-click the “Databases” folder and choose “Restore Database”. Select “Device” and choose the file, then restore.
Another approach would be to script the database in SQL Server Management Studio (right-click the database, then “Tasks → Generate scripts…”). During this process there’ll be a step called “Set Scripting Options”, where you’ll have to click the “Advanced” button and carefully go through the options. You’ll definitely want to choose “Data and schema” for the option “Types of data to script”. I sometimes prefer this method if I really just want the data structures and the data itself to be transferred.
Update: Sorry, I forgot to mention how to restore the database for the scripting option. I always generate the scripts by selecting “Save to new query window” during the “Set Scripting Options” step. After the script is generated, just leave it there for a moment.
On the target server create a new database with the same name as the one you generated the scripts for. Or you can create a script for that on the source server, too (right-click the database, choose “Script Database as → CREATE TO… → Clipboard”) and execute this script by right-clicking the server node in the SSMS Object Explorer, selecting “New query”, pasting the script into the query window and executing it. This second option is the better choice if you really need a complete copy of the database and not just the data itself.
Once you’ve gone down one of these two roads you should have created a new database. Right-click this database in Object Explorer and select “New Query”, then copy and paste the script containing the database structure and data into the new query window and execute the query. This should do the trick. Thanks to Onkel Toob