Home > OS >  Generate Scripts to move a database from one server to another
Generate Scripts to move a database from one server to another

Time:11-27

I want to move a database from our testing server to my local server. I don't have the option of back up and restore since I don't have permission. So I decided to use the generate script option to create all the scripts for the DB and then move over the database to my local server. The problem I'm facing is that most of these tables have foreign key relationships and when I generate the scripts, they are being generated in alphabetical order and therefore my scripts are failing. Is there a way to generate scripts where the tables are aligned based on their foreign key relationships? If not, is there some other way to achieve this?

CodePudding user response:

You have to choose some settings on advanced options. Remember setting the right compatibility level of your server target, this option can mess your script.

I've use this tool to migrate many times from SQL Server 2019 to 2019 (Windows and Linux) and to 2012.

One thing you have to check before saving your script, it's the encoding when you have to include data.

advanced scripting options

compatibility level

encoding

  • Related