I encountered a similar problem when trying to execute edmx.sql in VS 2013, EF6. This solution is not mentioned anywhere, so I will add it here for anyone who may encounter the error: "Mynewdatabase does not exist." Below is my solution:
- Follow the instructions to compete with database generation from the model.
- Open the * .edmx.sql file (it should have opened automatically). Right-click anywhere in the text editor and select Run.
- If this is your first time connecting to this db, log in. A prompt will pop up. If you use LocalDB, enter the server in the same way as "(localdb) \ v11.0" and use Windows authentication.
Now the problem. If you get an error: "The database mynewdatabase does not exist", here's the fix: At the top of * .edmx.sql there is such a line:
USE [mynewdatabase];
You must change this to include the full path to the name of your database, for example. So:
USE [D:\Projects\MyNewProject\MyNewProject\App_Data\mynewdatabase.mdf];
Now repeat step 2, and you should get a message that the database was created successfully.
Note1: .mdf extension required!
Note2: You must do this editing manually every time you create a database from a model, as this process overwrites edmx.sql.
source share