0

I'm trying to migrate my database to another server, an older version. Currently my database is on SQL Server 2014, but I need to add migrate it to SQL Server 2012 because that's the one my server has.

I installed both versions of the server (2012 and 2014) on my local machine. Created the script with the correct version (from the 2014 edition server, following "Tasks->Generate Scripts" with both schema and data, since my data is quite small in size), and now I'm trying to execute the script, but I got the following message:

Msg 5170, Level 16, State 1, Line 2
Cannot create file 'C:\Program Files....mdf' because it already exists. Change the file path or the file name, and retry the operation.

I understand the script is trying to create a database that already exists, so do I need to change the script?

Paul White
  • 94,921
  • 30
  • 437
  • 687

1 Answers1

2

The script generated will have the data folder for your 2014 instance. Since the database already exists on the 2014 instance, and the files are already there, the CREATE DATABASE statement will fail.

Change the path in the CREATE DATABASE statement to the 2012 data folder.

Chad Mattox
  • 2,156
  • 11
  • 13