Categories: SQL ServerTech

Downgrade SQL Database 2012 to 2008 Or Earlier Versions

Problem:
Sometimes peoples have requirements; they need to transfer the database from newer versions to earlier versions due to client’s necessity. As I said, you have a database on SQL Server 2012, but your customers have 2008r2 or earlier versions. Migrating the database from older SQL server to the newer version is pretty much easy. All you need a complete backup and restore it to the latest version or release as SQL 2012 have backward compatibilities. However, Downgrading SQL Database 2012 to 2008 Or Earlier Versions is not that simple. In order to overcome, these problems follow the steps below.

Solutions:
To the best of my information, I would recommend you two simple ways to complete this task.
• Generate Complete Scripts for both Schema and data
• Generate Script for Schema & Use Import / Export utility.

Some folks are thinking why am I suggesting two methods, what are we supposed to do? So, don’t worry. It depends on best practices and size of your database.

Generating Database Scripts:

This method is very useful and attractive for database developers to transferring their database structure or schema objects like tables, views, stored procedures, functions. However, some of you might know that you can transfer data as well. Let’s start.

Generate Scripts In Sql Server for transferring database.

Login to your SQL Server Instance where you have hosted your database. Right click on your database that you want to transfer, go to tasks > generate scripts as you can see in the above picture.

Generate Scripts For Database Objects

Once you can create script, you will be redirected to this wizard. Then press ‘Next ‘ button to proceed further. There are four steps to complete this wizard.

 

Select Database object to script

On this screen, you will have the option to choose objects. By default, all objects of the entire database will be selected. Although you can select your desire objects such as tables, views and etc. if you do not have an idea then go with the default, like I did on this screen and ‘next ‘.

Specify How Scripts should be saved or published In SQL Server

Next Screen is “set scripting options”. Now don’t go with next, this time you have to navigate to Advance options because we have to change some parameters that are necessary for transferring data from newer to lower versions. So, go to advanced and here have to the next screen.

Select Script for server versions.

In advance screen, the first parameter, which you need to set, is ” Script for Server Version”, as you can see, choose whatever version which fulfils your requirements. In my case, I’ll select SQL Server 2008 R2.

Second parameter, which you need to select, is “Types of data to script”. There are three option:
• Data Only
• Schema and data
• Schema Only
Let me clarify all three types, benefits and drawbacks.

Data Only:

Data only is an excellent option given by SQL server. Quite attractive if you are moving your data from one place to another via SQL file. This method will extract all your data into .sql file command. The only drawback is that the .sql file becomes heavier with respect to the data. If you are moving small size database under couple of GBs then, it will be a good option to transfer. However, if you are dealing with more than this then, it will be chaos for you.

Schema and data:

Schema and data just mean you can script both schema and data in single .sql file. Condition applies as I said earlier if you are dealing with big data like more than couple of Gbs then it will take time and space to convert this database structure and data into .sql file.

Schema Only:

As describe Schema only. You can script all your database structure means tables, views, stored procedures, functions and etc. into SQL file.
I would recommend you to script schema and data only if you are dealing with the couple of Gbs. You can also script Schema only and data only into two different files . It will allow you to maintain your DDL and DML separately. As of now I will go with Schema and data then press OK.

Provide file name and path to save your customized database scripts. Click Next for final summary.

Database has been extracted in SQL File.

After couple of next, you will be here at final stage. As you can see your entire database schema with structures have successfully extracted into SQL file. Now our half work has completed. We have exported the database with data. Now let start to execute this SQL file on SQL Server 2008 R2.




  • Tags: SQL Server
    Rameez

    View Comments

    • @Rameez This is the only post I see in this category. Probably other users at Literacy Base find it too technical. However, I hope Google Search will have included this what seems to be a very useful blog

    Recent Posts

    Heart Attack Causes and its Solution

    What is the Main Cause of a Heart Attack? What is its Solution? A heart attack is the blockage of… Read More

    1 year ago

    Understanding the Debt Ceiling: Its Impact, Importance, and Implications

    In the vast economic arena, one term that often takes center stage, inciting extensive debates and discussions, is the "debt… Read More

    2 years ago

    De-Dollarization: The New World Order of Currency and Its Global Impact

    De-Dollarization: The Changing Face of Global Finance The financial landscape is in a state of flux, with an intriguing economic… Read More

    2 years ago

    Unstoppable Bayern Munich: The Story Behind Their 11th Consecutive Bundesliga Title

    The curtains closed on a dramatic Bundesliga season with Bayern Munich standing tall once again, clinching their 11th straight title.… Read More

    2 years ago

    Celine Dion Cancels Concert Tour Due to Deteriorating Stiff-Person Syndrome

    The Unfolding Story of Celine Dion's Health In recent news that has left fans across the globe stunned, iconic singer… Read More

    2 years ago

    Navigating the Crossroads: LeBron James, Anthony Davis, and the LA Lakers’ Uncertain Future

    As the echoes of the recent NBA season start to fade, the attention of enthusiasts is firmly glued to one… Read More

    2 years ago