A. Export from MSSQL 2012
1. On Microsoft SQL Server Management Studio of SQL Server 2012. Right click on the database that you want to backup and select Tasks >> Generate Scripts.
2. On tab Introduction of Generate and Publish Scripts screen, click Next.
3. On tab Choose Objects of Generate and Publish Scripts screen, select Script entire database and all database objects, then click Next.
4. On tab Set Scripting Options, click Advanced button
5. On Advanced Scripting Options screen:
-set Script for Server Version to old version which you want (e.g. SQL Server 2008 R2);
-set Types of data to script to Schema and data
-in Table/View options: select types of scripts which you want
6. After selecting advanced options, then file name to save and click Next
7. Wait for finishing
B. Import to old version (e.g. MSSQL 2008 R2)
- Open SQL Server Management Studio >> open the sql file and run to import
- In the case large file, you can run command:
SQLCMD -E -i input.sql -o output.txt
-Or run command below, if you want to import to existing DB
SQLCMD -E -d db -i input.sql -o output.txt