Accsys Consulting logo
About Accsys Consulting

Accsys Consulting is a renowned Canberra-based company, established in 1992, offering specialised financial management and information technology consulting services to valued public and private sector organisations. Our enduring commitment is to assist clients in developing their customer relationship management (CRM), enterprise resource planning (ERP), and financial management information systems (FMIS). We achieve this through a highly skilled team proficient in the implementation and support of leading software solutions like Sage Intacct, Sage 300 and Sage CRM.

With an impressive track record spanning over 30 years, the directors and staff of Accsys Consulting have continually demonstrated their expertise in successfully implementing and supporting Sage Intacct, Sage 300 and Sage CRM solutions. Our team includes Chartered Accountants who possess the expertise to aid clients in financial statement preparation, auditor liaison, and grant acquittal statement review.

Our exceptional reputation has been built upon delivering effective solutions, ensuring prompt implementation, and providing reliable personal service. Today, our respected clientele encompasses public sector organisations, listed public companies, not-for-profit organisations, and private companies.

The exceptional quality of our service makes us proud to have successfully implemented and supported Sage Intacct, Sage CRM and Sage 300 across sites throughout Australia, with a significant number of our clients within the Canberra region.

Partner with Accsys Consulting for comprehensive financial management and information technology consulting services that drive success and ensure optimal efficiency and growth for your valued organisation.

Follow Us On Social
 

SQL Server: Copy database from recent to older versions

SQL Server: Copy database from recent to older versions

Recently, I needed to copy a database from SQL Server 2012 to SQL Server 2008 R2.  Unfortunately, database backups from one version of SQL Server cannot be read by a lower version.  To work around this, I had to use the “Generate Scripts” function to first create the structure and then populate the database.
Whilst none of this is particularly complex, I thought it might be useful to collate the steps in one document…

Step 1: Generate structure scripts

  1. In the SQL Server instance that contains the database to copy, right-click on the Database in the Object Explorer, select Tasks, then select Generate Scripts.
  2. In the Wizard, progress to Choose Objects and make sure that “Script entire databases and all database objects” is selected.
    Screenshot: Select "entire database" option

    Select the “entire database” option.

  3. Progress to the “Set Scripting Options” stage.  Click on “Advanced” and make sure that the “Type of data to script” option is set to “Schema only”.  Also set the “Script for Server Version” option to the other SQL Server’s version (I still ran into incompatibility problems with the generated script, however).
    Screenshot: Advanced options in Generate Scripts

    Advanced options in Generate Scripts

  4. Finish off the Wizard, copy the generated scripts to a location that the other SQL Server instance can access and run them in that Management Studio.  Here are the main problems and fixes I ran into during this part of the process:
    1. Error message that “CONTAINMENT is marked as incorrect syntax”:  Just comment out the “CONTAINMENT = NONE” line (source: http://stackoverflow.com/a/15410854)
    2. Error message that CREATE Database commands can’t be run in a multi-transaction statement:  Just run the create statement separately.
    3. Error when trying to alter user to add role:  This command is not supported in older versions; change those commands to use “sp_addrolemember” (e.g. EXEC sp_addrolemember ‘db_datareader’, ‘Administrator’) (source: http://technet.microsoft.com/en-us/library/ms187750.aspx).
  5. If that all goes well, you should now have the database skeleton ready.  The next step is to import the data.
  6. Back on the originating SQL Server, go to Generate Scripts again, but this time in the Advanced options, set “Type of data to script” to “Data only”.  Because this will probably require a lot of space, in the “Set Scripting Options” screen, set “Files to generate” to “Single file per object”, to split up all of the scripts by table.  Finish the Wizard.
  7. You should now have a bunch of script files, ready to be run.  Copy the containing directory to a location the older SQL Server can access.  Because I had 219 generated files, to save on running them manually, I used the following batch script (create and run it from the containing folder):
    for %%G in (*.sql) do sqlcmd /S servername /d databaseName -E -i"%%G"
    pause

    (source: http://stackoverflow.com/a/6504317)

  8. The above script may take a while to run, but after that, you should be done!

 

Tags: