Is SQL Server 2008 compatible with 2005? - sql-server

I have a problem with my website. When I publish my site on server, I got an error message:
The database '----------------------------.MDF' cannot be opened because it is version 655. This server supports version 611 and earlier. A downgrade path is not supported.
What can I do about this?

You can't push a 2008 mdf file into a 2005 server. It just won't work. The problem is that sql 2005 has no idea what features you may have used in the 2008 database which doesn't exist under 2005.
Your only real option is to:
1. Create a blank database on the sql 2005 server.
2. Script your tables, views, procs, functions, etc from the 2008 server.
3. Run that script on the 2005 server.
IF you used some advanced features, then the 2005 server will not be able to run the script. Fix what you have to.

Yes... in SQL 2008, generate scripts for your DDL and DML; the vast majority of the scripts will be compatible, but you may need to make the odd tweak to accommodate SQL 2005.
Upload and run on your SQL 2005 instance...
There maybe a number of 3rd party tools that can aid you, particularly to generate the insert statements.
If your DB is particularly large, you might want to is SSIS to move the data across.

Related

Using the same database on different versions of SQL Server

We have several SQL Server databases at work and we plan to keep all of them in a Database Server. However, while we use SQL Server 2014 in some of the databases, there is also a database (let's say ABC) with the version of SQL Server 2008 R2.
The problem is that; ABC is a database originated from another company and sometimes it is updated by them using scripts, etc. So, this means that we have to go together with the version they use. As far as I know, it is possible to restore a database of version 2008 R2 in the version of 2014 but the reverse operation is not possible (to restore a database of version 2014 in the version of 2008 R2).
So, in that case what is the best way to solve this problem by using the single database (SQL Server 2014) on the same server?
You can generate database from the 2014, 2008 compatible. You can dig into the advanced option and you will find creating scripts for triggers, indexes and all dependent objects.
Generate Scripts
Choose Compatibility
Specify Data generating scripts
The server could be 2014.
You just need get SQL Server Management Studio (SSMS) version 2008 and generate backup using it.
You could have lots of SSMS versions.

Does my sql code go unavailable when I upgrade my SQL Server from 2008 to 2014?

I have a server running SQL Server 2008 Enterprise version which has a lot of SQL Codes and I want to upgrade it into SQL Server 2014 Enterprise version. But I don't know what will happen after I upgrade the SQL Server. Will there any SQL Code go unavailable/error? Will it run correctly after upgrading?
SQL Server 2008/2014 is a tool. It has got nothing to do with data/procedures/views etc. Data for SQL Server is stored in the form of .mdf files. So, no, your data or procedurers wont be touched. But yes lot of features are going to be deprecated in SQL Server 2014 when compared to SQL Server 2008. Full list is here. You should go through the list and find a suitable replacement for every deprecated item before migrating.

Cannot restore a database with a .bak file due to another SQL server version

I have installed SQL server 2008 R2 and i try to restore a database a colleague sent me in a .bak file.
Unfortunately, i cannot restore the database since the database was saved on a server from version 10.50.1600 and my SQL server version seems to be 10.00.1600.
I tried to upgrade my SQL server with SP1 and SP2 packs but it didn't change anything.
Otherwise, i noticed by clicking on the server property that the line "product" displays Microsoft SQL server Express edition even though i have installed SQL server 2008 R2. That's at least what is displayed when i fire it...
Can anyone help me ?
Thanks in advance
You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version (SQL Server 2008 R2 - 10.50.1600) of SQL Server down to an older version (2008 - v10.00.1600) - the internal file structures are just too different to support backwards compatibility.
You can either get around this problem by
using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances
otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool
or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.
Understand, what the version numbers mean. You need to be on R2 which is not just a patch or service-pack.

Problem with importing an mdf created with SQL Server Express 2008 into SQL Server 2005

The question is probably extremely easy to resolve, but I need to resolve it because I need to carry on with my project. I am using SQL Server Express 2008 at home, and I've been working on an ASP.NET MVC app that stores my DB in an mdf file in the project's folder. The problem is that the SQL Server in the Uni labs is SQL Server 2005, and when I try to open the mdf file with the VS Server Explorer,It says that the version of the mdf file is more than the server can accept.
The only option that comes to my mind is exporting the DB as an sql file, just like I've done it thousand times with phpmyadmin. the thing is that the SQL Management Studio Express is not the most usable tool in the world, and for some strange reason all the articles I could find in Google were irrelevant. Please, help.
It is not possible to attach database created on SQL Server 2008 to SQL Server 2005. The other direction is possible.
Your only option is to script the database and data and run the scripts on SQL 2005. If you have used any of new features of the SQL Server 2008, you will have to rewrite the scripts.
I haven't used it much, but right click on database -> Tasks... -> Generate Scripts... / Export Data... / Import Data... should do the job right.
Google "Database Publishing Wizard", it's a tool from Microsoft to script an entire database, both schema and data.
you can script your db and its data. then run it on the target server to create a new db that is compatible with 2005 version.
Tools like Red-Gate SQL Compare and SQL Data Compare can compare a live database to e.g. a backup file, so you could compare your SQL Server 2005 database against the SQL Server 2008 Express backup file, and move data that way.
Or you could possibly generate INSERT statements for your tables that have changed data using a tool like this one here or this one here. These can generate INSERT scripts for your tables, which you can take along and run on your SQL Server 2005 target system.

How can I get a SQL Server 2005 compatible backup from SQL Server 2008 database?

I have a sql server 2008 db, I want to restore its backup to a 2005 version. Is there any way for this work?
Note: I can't make a script from my db and run it.
No. It is not possible to restore a database from a backup of a newer version.
The only solution I have come accross is generating a script, but it seems that you do not want to use this
Unfortunately, SQL Server has never supported this - and still doesn't :-(
There is no way you can create a backup in a newer version and restore it in a previous version - and this goes from SQL Server 4.2 all the way through 2008 R2.
All you can do is either create scripts and run them on the target server, or use tools like SQL Compare and SQL Data Compare to compare the two databases and update the target database from the source (basically, what these tools do is create and execute the necessary scripts in the background, so you won't have to fiddle and create those scripts yourself)

Resources