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?
Advertisement
Answer
You have to change some settings on advanced options. Remember setting the right compatibility level of your target server, this option can mess up your script.
I’ve used 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 is the encoding when you have to include data.