Migrate from SQL Server 2012 back to SQL Server 2008

Posts   
 
    
JayBee
User
Posts: 275
Joined: 28-Dec-2006
# Posted on: 13-Dec-2013 00:13:45   

Hi,

A couple of months ago I have set up an new develeopment machine. I'm using LLBLGen for data access to a SQL Server 2012 database.

On the production server I have SQL Server 2008 running. And now I have to configure the database. Usually I would prepare this on my development machine, make a backup of the relevant databases and restore them in production. The problem is that SQL Server 2012 backups are not usable on SQL Server 2008.

I was thinking about using LLBLGen. Make one big model per database and have LLBLGen generate the database creation scripts. Than perhaps write some code to export and import the date.

Is this doable? Has any of you done this before and are you willing to share the code? Or would you go for another solution?

Best regards,

Jan

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Dec-2013 07:10:52   

Hi Jan,

You could do it, but LLBLGen is not meant for that, you could face performance issues, or sync issues. If you still want to try, you should create two different DBSpecific projects, one targeting 2012 and the other 2008, then Load all records from one table and insert them using the other DataAccessAdapter. You should flag .IsNew = true before send them.

There is no a shipped code for what you want. My recommendation is: try to generate export scripts from SQLServer 2012, or find other useful tools for that: http://stackoverflow.com/questions/10303791/create-database-in-sql-server-2012-script-and-use-in-2008

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Dec-2013 10:20:28   

I still think llblgen pro can do this, as the scripts we export are compatible with 2000 and up so they're not containing any specific 2012 features, unless you use sequences of course.

You can also export data in sqlserver management studio, though my experience with that is that it often forgets something, like not migrating fk's, pks etc.

Frans Bouma | Lead developer LLBLGen Pro
JayBee
User
Posts: 275
Joined: 28-Dec-2006
# Posted on: 13-Dec-2013 17:05:03   

The main goal I have is the creation of databases and tables, views, stored procedures with all the extra stuff such as keys, indices, identity specs etc. (I'll probably will not be able to do this with the diagrams).

I do not use sequences.

The data I have to add to the tables is mainly configuration data (parameter tabels). This can be done via cut and paste.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Dec-2013 17:53:31   

If you use views/procs, the designer can't help you as it doesn't read view/proc definitions, so it can't export them. So you need to use other tools for exporting those (SSMS might help, not sure)

Frans Bouma | Lead developer LLBLGen Pro
JayBee
User
Posts: 275
Joined: 28-Dec-2006
# Posted on: 14-Dec-2013 09:38:54   

I was hoping Generate database schema creation script would also add the view creation scripts. As you mention it doesn't (allthough the views are part of my project). Is there a specific reason for this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 14-Dec-2013 12:38:54   

JayBee wrote:

I was hoping Generate database schema creation script would also add the view creation scripts. As you mention it doesn't (allthough the views are part of my project). Is there a specific reason for this?

Yes: on many databases, the proc and view definitions aren't retrievable through a sql statement, and some databases have the feature to encrypt view and proc definitions (sql server has this for example: so it does allow view/proc definitions to be retrievable with some low-level queries, if the elements are encrypted, the sql isn't obtainable).

We also don't read the definitions as they're not used in our system and they would bloat the file format a lot, and perhaps one doesn't want them in the project file.

Frans Bouma | Lead developer LLBLGen Pro
JayBee
User
Posts: 275
Joined: 28-Dec-2006
# Posted on: 24-Dec-2013 09:56:56   

OK. I used another tool to help me here (RazorSQL).