SQL Server 2008 R2 and SQL Serve 2008 Express not playing ball - sql

I have a database created on a box using SQL Server 2008 Express and am developing a website between that and another box (set up by a friend a while back) using 2008 R2. Unfortunately, I've hit two problems.
The first is that on the R2 box, while it will load in the database from 2008, it won't allow me to add tables (it gives the well worn and completely useless Specified module cannot be found HRESULT: 0x8007007E) - I can do everything else but add tables.
The second is that when the file is accessed and updated to SVN, the other box cannot use it as the version numbers differ (655 [2008 Express] on one 661 on the other with no downgrade path). Grrr!
My plan is to do this - copy the SQL file on the 2008 R2 box to an SQL script. Remove R2 from the machine completely and just do a default install of 2008 and reimport the script. Only problem is that I'm clueless on how to do it.
Can anyone recommend a piece of kit that will do this or point me in the direction of a website that may help? Google produces masses of hits, but doesn't always help on this one.
Thanks
Paul

From your description, it appears that you've got SQL Express 2008, not SQL Express 2008 R2;
Have you considered upgrading the SQL Express to SQL Express 2008 R2 http://www.microsoft.com/download/en/details.aspx?id=23650
SQL Express isn't a version, but is just an Edition. It might be easier to upgrade the SQL Express 2008 to SQL Express 2008 R2.
But... this is probably what you are looking for if you are set on exporting the database to a script.
http://blog.sqlauthority.com/2011/05/07/sql-server-2008-2008-r2-create-script-to-copy-database-schema-and-all-the-objects-data-schema-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/

Related

Can I restore a backup which was on SQL Express to sql server server 2008 without any problems

I am going to do a customer SQL upgrade and they currently have SQL Express and I want to upgrade it to Microsoft SQL server 2008.
Will it be okay to restore the SQL Express backup to Microsoft SQL Server 2008?
First off, the comments seem to mention MySQL. I can see that you edited it to say SQL Express. If it is indeed MS SQL Express then yes, as SMM said it will work.
I have done this a few times before, and it worked just fine. Though rather than a backup/restore I would move the .mdf file.
This is done by detaching the DB from the Express instance and attaching it to the Server 2008 instance; this can be easily done via sqlcmd or the Studio Manager. The steps can vary based on systems(s) setup. As such, I did a google search to see if there existed a step by step guide for this rather than typing a bunch of scenarios as shots in the dark. There are a plethora of them:
I just Googled: move sql express .mdf to sql server 2008
I also found this and it would seem to be a good match for your situation and has good information:
http://www.mipsis.com/help/Moving%20SQL%20Express%20Database%20to%20SQL%20Server.pdf
Let me know how it goes, and if you need specific assistance with the process please follow up.
I have done SQL Express to SQL 2000 and SQL 2005 successfully in the (distant) past. I am sure this will work. I don't remember any specific caveats other than making sure that you don't try to go from a later version of Express to an earlier version of SQL.

Migrate from Windows 2008 SQL Server to SQL CE (for WebMatrix)

I have some stuff in my remote SQL Server 2008 DB. I want to put it inside my SDF database (the WebMatrix one). But I can't just copy the rows from Navicat (while viewing table for SQL Server 08) into the SDF database because some rows don't let you manually insert stuff.
So I need a way to "Migrate" from Windows SQL Server 2008 to SQL Server CE (.sdf).
I think I have the right tools to accomplish this, but would appreciate it if someone can point me in the right direction.
I have:
Visual Studio 2012 Ultimate RC
Web Matrix
Navicat Premium
Well, after hours of searching, I've managed to solve this issue.
How to Migrate/Downsize a SQL Server database to SQL Server Compact 4.0 (and 3.5) has an extremely straightforward approach to doing this.
Like myself, you may need to download the following tools (and place them in the same directory as your CMD.exe file:
SQL Compact Command Line Tool
SQL Compact data and schema script utility

How can I restore a database backup file (.bak) from SQL Server 2012 into SQL Server 2008 Express?

A database that was originally from SQL Server 2008, was restored into SQL Server 2012. A backup from SQL Server 2012 was made and I am trying to restore it on my local SQL Server 2008 Express. However I get an error 'Specified cast is not valid' (SQLManagerUI).
I have generated an SQL Script from 2012 and set it so that it will generate with compatibility to SQL Server 2008. However it is a large sql file, around 700mb.
I recall before that I had tried to run a script of that size before on my local SQLExpress and also got an error.
Is there a way I can get a "large" database from SQL Server 2012 into SQL Server 2008 Express?
Thanks to Marc and Aaron for providing the answers.
The quick answer is no, it's not possible to restore a backup file from a higher version to a lower version of SQL Server.
A work around would be to generate the scripts to create the database.
You can target the script generation to a lower version.
Please see comments above for more information.
Links:
Why an SQL Server Database from a higher version cannot be restored onto a lower version of SQL Server?
Create Database in SQL Server 2012, Script and Use in 2008?
Couple things to add that might be helpful to folks
When scripting large databases using scripting wizard in SSMS it’s really important to check the execution order and be willing to re arrange it manually. Older versions of SSMS had this problem because they (probably) relied on sp_depends that has a bug.
What I’ve found really useful in such cases are tools like ApexSQL Diff that you can use to read database backups and generate scripts that are in correct execution order.
SQL Server database backup restore on lower version
One thing that none of the methods will catch is the thing Aaron mentioned about using functions specific to higher version.
A better option than using the SSMS scripting wizard is to use a similar tool available on Codeplex called SQL Database Migration Wizard - http://sqlazuremw.codeplex.com/releases/view/32334. You want the latest version v4.x to work with SQL Server 2012.
The tool is originally intended to be used for migrating databases between SQL Server and Azure. However the tool works just as well as between SQL Server and SQL Server. The trick is to set SQL Server rather than Azure as the target in the advanced options.
The reason this is a better option than the SSMS scripting wizard is that it uses BCP for the data transfer rather than TSQL and so is much more efficient.

SQL Server 2008 Web edition

My company is planning to migrate it's intranet/internet based ERP to the latest form of MS SQL Database available.
Presently we are using SQL Server 2000 Professional.
And we are planning to shift to SQL Server 2008 Web edition.
Please tell me whether this is the right step and whether it is feasible or not.
Thank you in advance.
"Please tell me whether this is the right step " - that's something you and your company need to decide.
It is feasible, and in the majority of cases straight forward.
Your first step should be to run the Microsoft SQL Server 2008 Upgrade Advisor
Microsoft SQL Server 2008 R2 Feature Pack contains the Microsoft SQL Server 2008 R2 Upgrade Advisor
Formulate and test a rollback plan
Determine your upgrade window and acceptable downtime.
Ensure database consistency: Run DBCC CHECKDB on databases to be upgraded to ensure that they are in a consistent state before performing the upgrade.
Back up all important files: Back up all SQL Server databases from the instance to be upgraded (including master, model and msdb), data and transaction log files, as well as any application files, script files, extract files, etc. so that you can completely restore them in the event of a failure.
It's both feasible and easy. The path from one version of SQL Server to another is usually pretty simple. Do you have any special stored procedures or reports generated in SQL Server that need to be rewritten/re-imported?
As far as right step - the question is, Why? If it's working, do you really need to mess with it?
If it's for intranet (some app for your internal usage) then consider using SQL 2008 Express edition. It's free and you can use it as an instance running along the full 2000 version. That way you will have some extra features from the full version.
But you have to know that applications running on SQL 2000 may not work on 2008 and they are even more probable not to work on 2008 R2.

Methods to migrate SQL Database (mdf) to SQL Compact Edition (sdf)

I have 4 SQL Server 2005 db's that I want to move to SQL CE. I know I cannot keep the SProcs,Views, and Functions(Differences Between SQL Server Compact and SQL Server) but I would like to keep everything else.
I have tried this app, SQL Server to SQL Server Compact Edition Database Copy but it errors out on me. I have the source and am looking into it but I thought I'd check and make sure I wasn't over complicating the solution to my ACTUAL goal.
Is there a simple, can be one shot, way of converting standard SQL .mdf to SQL CE .sdf?
Right now my best idea is to set up Replication to the SQL CE from the SQL 2005 Standard.
http://erikej.blogspot.com/2010/02/how-to-use-exportsqlce-to-migrate-from.html
1.Use SQL Server to SQL Server Compact Edition Database Copy with sqlcompact 3.1 or 3.0 not sql compact 3.5
You can use a virtual machine like sun virtual box, install sql compact 3 or 3.1 on it, and convert your database inside it
2.You can convert to sql compact manually
Use the SDFViewer utility:
go Tools Menu > From SQL Server
Enough said....
What if you scripted the objects from 2005 and ran the script in CE? That'd give you the structure of the DB, then you could select/insert?
I haven't tried this, but what about SQL's DB export/import tools in management studio?