Cannot open database.mdf after opening in Visual Studio 2012 - visual-studio

Ive been working on some stuff with Visual Studio 2008, and SQL 2008 aswell..
Then i opened the project on another computer with 2012 version.
And now when im trying to work with the files in 2008 again, i cant open my database.mdf, becouse the 2012 sql has upgraded my database file...
Anything i can do to save it?
(Btw. the data aint that important, but more the whole table setup and relations)

Install 2012 SQL Server Express with Management tools, attach the MDF and extract the schema by generating "create" scripts for the objects you want using the wizard, then re-run the scripts on the new 2008 DB, don't think there's a way to downgrade. See here.
Or you can just keep developing on top of SQL2012, shouldn't be a problem even if you use visual studio 2008.

Related

Not able to modify tables on remote SQL Server 2012 database

I have Visual Studio 2010 installed on my Windows 10 PC. My website is on a shared hosting environment and utilizes a SQL Server 2012 database.
The hosting provider doesn't have web interface to manage database so I connect from the Visual Studio 2010 itself for management purposes.
Right now I am able to connect to the database and run my website locally but when I attempt to open table definition, I get this error:
This server version is not supported. Only servers up to Microsoft SQL Server 2008 are supported
Before upgrading to Windows 10, I was able to edit/add tables from Visual Studio 2010 Server explorer but now limited to read purposes only. This Windows 10 and Visual Studio is completely fresh install with nothing kept or saved from earlier windows version. I don't remember if I installed any SQL Server 2012 tools in earlier windows for managing the database from Server Explorer in Visual Studio.
I have searched a lot and even tried installing SQL Server 2012 Express which failed. Now, I am downloading SQL Server 2012 Management Studio from the same link to see if that will work. It will download in an hour or so but I don't remember downloading it earlier so wanted to ask you what can be done.
All I want is the ability to add/modify tables of SQL Server 2012 database from Server Explorer in Visual Studio 2010. Please tell me how can that be done and which tools are required for this purpose.

Visual studio wont open mdf file

The problem I have is that I'm unable to open my mdf file in Visual Studio 2010. I installed VS2010 along time ago, but just installed SQL server 2008 R2 few days ago.
I made the file in VS2010 and then attach it to SQL server in Management Studio to run a script I have to create all tables and such.
I then detach it in Management Studio and try to view it in VS2010 and get an error telling me that I cannot open database version 661. I can only go as high as 655.
I know this is because VS2010 is using SQL server 2008, but Management Studio is SQL Server 2008 R2.
How can I make VS2010 compatible with SQL Server 2008 R2?
You simply need to upgrade the local version 2008 Express to R2. You'd be able to open your file after that.
I had this problem too, but my problem was solved when I did this:
When you are opening SQL Server Managemnt Studio, in the connect to server window, type "\SQLEXPRESS" after the server name (your server name\SQLEXPRESS), then attach your database. When you detach it, it is compatible with VS2010. I hope this helps you.

How do I convert a Visual Studio 2010 database project to an SSDT Project

I have a clean install of windows 7 with Visual Studio 2010 Premium inc. SP 1. I also just installed the developer edition of SQL Server 2012 .
I now should be able to convert the Visual Studio 2010 database project to an SSDT project. According to this technet blogpost it should be as easy as opening my Visual Studio solution file and follow the conversion wizard. The problem is that the conversion wizard never appears. Also, the "Convert to SQL Server Database project..." context menu item does not exist when right clicking on the VS 2010 database project.
I'm probably missing something in my SQL 2012 installation. The question is: what?
My SQL 2012 install configuration:
In case it helps someone else.
In my case I did not get a wizard of any kind, even though I did ALL necessary installs.
Symptoms:
Open solution in VS2012.
Database project is unloaded, it says it needs migration.
Reload database project, it says it requires functional changes (or something like it). I press OK.
Database project is available, it builds, but when I close VS2012, and re-open the solution, it says the same thing over and over again.
Solution:
Unknown to me VS2012 does create a new project of ssdt type. Unfortunately it doesn't load it. I have a project .dbproj file and a project .sqlproj file. The .dbproj file is loaded.
Remove the database project from the solution.
Add existing project -> select the .sqlproj file. The database project is loaded again. It builds.
Now everything seems well, I can open and build the solution in VS2012 without any problems. Also, I can reopen the solution in VS2010SP1, and it opens and builds without any problems.
Found the problem. Apparently I still needed to download SSDT standalone from http://www.microsoft.com/web/gallery/install.aspx?appid=SSDT. Althought SQL Server Data Tools is listed in the screenshot above.
EDIT: Updated the link. Thanks #ryanwebjackson
If you have a situation where you're trying to migrate from .dbproj created for Visual Studio 2008 to .sqlproj for Visual Studio 2012 you might run into same behavior (no wizzard, can't load project).
In my case there was even quite absurd situation where Visual Studio 2012 created .sqlproj file and copied into it the contents of old Visual Studio 2008 .dbproj.
None of the proposed workarounds helped, I had to first convert from 2008 .dbproj to 2010 .dbproj (using Visual Studio 2010) and then from 2010 .dbproj to .sqlproj (using Visual Studio 2012).
For me something diffrent works.
After migration you will have both *.dbproj and *.sqlproj in project directory.
Just remove project (dbproj and attach existing sqlproj project).
Do not know why solution file is not updated.

Visual Studio 2010 database project intellisense for SQL Server 2005

I have a Visual Studio 2010 database project for my SQL Server 2005 database.
It works fine and has intellisense when editing definition files for objects, but if I want to try running anything against the database as soon as the script file is connected I loose intellisense. I realise this is because Visual Studio is trying to use connection intellisense rather than from the schema of the project.
Is there anyway to force visual studio to always use the schmea of the project so that I can have intellisense all of the time?
Any solutions I have seen so far for this have required the use of a third party product to enable intellisense on SQL Server 2005, which is not an option for me.
Well it looks like this can't be done.

convert .mdf 2008 file to .mdf2005 file

I made a project in visual studio 2008 and attached a database to it...
But later on it installed visual studio 2010 and it automatically updated my project...
As now i reinstalled my windows and again approched to my project, it showed the following message when i double clicked my database file in the server explorer in vs 2008, vs 2008 sp1, vs 2010...
The only way to downgrade your database for SQL Server is to script out all the objects to recreate your schema on a previous version and bulk export/ import the data. Alternatively refer to backups.

Resources