Move database from SQL Server 2012 to 2008

Right click on the database in the 2012 SQL Management Studio, and choose "Tasks -> Generate Scripts". Click past the welcome screen, choose "script entire database and all database objects". On the "specify how scripts should be saved" page, click "advanced". Under "General" in the pop up properties page, change "Types of data to script" from "Schema only" to "Schema and data", and change "Script for Server Version" from "2012" to "2008".

I then had to find some way to edit the start of this massive SQL file, to tweak how the database would be created -- see this q:

And finally I had to find some way to run the SQL script, which was too large to open in SQL Management Studio -- see this q:

For SQL migrations, use the free and open source SQL Database Migration Wizard.

I had a 5GB database with couple ~10 million records and tried the route via Generate Script and than ran it with sqlcmd.exe. First of all, the generated script was not always working correct. Secondly, sqlcmd.exe can fail on large files too, complaining about available memory. osql.exe works, but just takes ages (and has the same command line arguments).

Then I came across a wonderful tool for migrating SQL Server to SQL Azure databases. This works for SQL Server to SQL Server as well, for example if you'd like to migrate a SQL 2012 database to 2008 R2. It uses bcp.exe, which uses bulk copy. There is a GUI and command-line (Batch) version available and it's open source. See In my case, the operation took 16 minutes.

In an advanced screen you can select that your target is SQL Server, not SQL Azure.

I'm new to SQL, but I managed to migrate from 2012 to 2008. To do so I used the SQL import and export utility. I chose the SQL 2012 server and the database I want to migrate and finally the 2008 server and created a new database as my database of destination. It worked.