Cannot attach 2008 R2 database to 2008 instance - sql-server-2008

So I have made a set up file and install it to target computer which has no .Net 4.0 or SQL Server 2008.
I add them as prerequisites and setup downloaded from the internet the .Net 4.0 and SQL Server 2008.
The setup finished successfully.
When I run the program, it gives an exception:
cannot open xxxxxx.mdf file. it is version 650. and your is xxx...
I searched it out and learned that SQL Server installed on target computer is lower than the database file I created (the database file was created in SQL Server 2008 R2).
So, no connections can be opened.
To solve this, What can I do?
Thank you...

You can't attach a 2008 R2 database to a 2008 instance - you can only go forward, not backward. So either install 2008 R2 at the destination, or you'll have to re-create your database in 2008. If you install 2008 locally alongside 2008 R2, you can create an empty database in 2008 and use tools like Red-Gate's SQL Compare / SQL Data Compare, or the schema compare feature in SQL Server Data Tools, to translate your database relatively quickly.

There is no way to open an MDF file with a lower version of SQLServer.
Of course you could add as a prerequisite SQLServer 2008 R2 (express or full).
But the best course is to distribute a SQL Script containing schema and data.
This could be done using SqlServer Management Studio,
Right click on the database
Select Task
Select Generate Script.
Follow the Wizard.
In the last page of the wizard you could find the button Advanced
Clicking on it will give you full control on what to put inside the script.
The script could be distributed with your application with instructions on how to execute on the target machine.

Related

Will MSSQL 2012 database work on MSSQL 2008 server?

I have MsSQL database which is created in MSSQL 2012 SQL server.
On my local machine I have installed MSSQL 2008 SQL server.
Will the 2012 database work in MSSQL 2008?
Also,I have installed MSSQL 2012 SQL server on my local system.Do I need to install MSSQL management studio for 2012 SQL server?
Is it required for user interface?
A full database backup and restore to the new server will not work. SQL server does not allow that to a previous version.
You can however create the schema and load the data in manually through SSIS or BCP.
For SSMS you can connect to a previous version.
Most of the features will work, But features specific to SQL Server 2012 may not work.
You don't need to use Management Studio of SQL Server 2012 in order to browse SSMS-2012 database. You can still continue to use the 2008 R2's IDE.
Whether a 2012 database will work on a 2008R2 server depends.
If you are deploying to your 2008R2 server by running T-SQL scripts then it will only work if
The database objects used in your 2012 database were available in 2008R2
You are not using SQL2012 T-SQL enhancements in your scripts
Your scripts do not depend on system objects or views that were introduced in SQL2012
The local edition of SQL2008R2 is compatible with the SQL2012 edition. For example SQL2008R2 Express will not like SQL2012 Enterprise Edition features.
Ideally you will be using the Developer Edition for your local instance as this is simply a throttled version of Enterprise Edition.
If you are trying to restore to 2008R2 from a 2012 backup then no, it won't work.
Given that SQL Management Studio is a free download why would you stick with the SQL2008R2 version? If you have licenced SQL2012 then you are licenced for the SQL2012 version of SSMS. Why not go the whole hog and install SSMS for SQL2017?
If you do not like SMSS then a paid for alternative might be Aquafold Data Studio. This has the advantage of supporting many database platforms from a single IDE.
it is not neccesarily required to have ssms 2012 . it will work as we have the sql server installed
Just reiterating PingPongOng - a backup and restore wont work as you can't install a newer database onto an older server. You can however go the other way, so a 2008 database could migrate to a 2012 server.
As others have said, you need to create scripts.
Right click on the 2012 database, and on the menu that appears -> Tasks -> Generate Scripts and follow the wizard that appears. This will allow you to create just the schema or schema and data (if required).

Provider string setting in SSIS config file on SQL Server 2008 R2

I've inherited an SQL Server 2008 R2 environment running on Windows Server 2003. I do not know if it was upgraded from SQL Server 2005 or if it was a freshly built out system. Due to issues with not being able to virutalize the physical server, it was decided to build a new, identical environment on a virtual server an migrate the databases and such to the new virtual server. We did decide to make one upgrade and that was to put Windows Server 2012 on the new server. We kept the instance name and server name the same (these were modified after we took the old physical server offline). I kept the file paths and folder names the same as well on the new server. I migrated the SSIS packages from the old server to the new server using the Export option in Integration Services (right click on the package>Export Package). The packages were stored in MSDB on the old server. I copied the config files from the old server to the new server and kept them in the same file location as they were stored on the old server. Ok, so here's my problem. When I started all of the SQL Agent jobs, several of the ones that used SSIS packages failed. After researching the issue, I
discovered it was due to the SQL provider string (Provider=SQLNCLI) was set to Provider=SQLNCLI.1, which is for SQL Server 2005. Once I changed this to Provider=SQLNCLI10, all was good. A caveat to this is that other packages that are using Provider=SQLNCLI.1 and are working just fine. The question that is eating at me is this, why were these packages running successfully on the old server which was running the same version of SQL Server when SQLNCLI.1 is supposed to be a setting used in SQL 2005 AND why are some packages working successfully still using SQLNCLI.1 and other had to be changed??
the execute of some packages depends by the structure of this file.
the are some task or some expression or some parameters that have been redefined in the new releases.

Run-Time error '-2147024703 (800700c1)' when running Access 2010 with SQL Server 2008

I have an application written in MS ACCESS 2007 using VBA, connecting to an SQL Server at the back end. Both Access and SQL Server are running locally.
My machine runs Access 2010 and MS SQL Server Express 2008 R2 (both 32-bit, on WinXP) with no problem.
I have another machine, Win7 64-bit, running both Access 2010 and SQL Server 2008 (NOT R2) 64-bit.
When I run the Access application on the 64-bit machine, I have a drop down box to select the SQL Server which holds the various databases. When I select the server, after a few seconds I get an error:
Run-time error '-2147024703 (800700c1)':
Automation error %1 is not a valid Win32 application.
When I select the Debug option, the yellow arrow points to:
Set oServer = New SQLDMO.SQLServer
The next line is:
oServer.Connect ServerName, strSQLUser, strSQLPwd
In the watch list, I can see that ServerName, strSQLUser, and strSQLPwd hold the right values to access the SQL Server. I've tested these in sqlcmd and successfully was able to query tables.
Can anyone please help me out on this one? I'm not sure what to do next.
Seems like you've got registered a 32-bit SQLDMO on your system that is being used for connection to the 64-bit instance. Check your registry / file system for SQLDMO.dll versions and register the correct one.
Also check MSDN "Installing SQL-DMO" because SQLDMO was scheduled for remove after SQL Server 2008 R2:
Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
SQL Server Database Management Objects (SQL-DMO) has been removed from SQL Server 2008 R2 Express and the SQL Server 2008 R2 Feature Pack. SQL-DMO also does not support Database Engine features introduced after SQL Server 2000. We recommend that you modify applications that currently use this feature as soon as possible. If you must support SQL-DMO, install the Backward Compatibility Components from the SQL Server 2008 Feature Pack from the Microsoft Download Center. Do not use SQL-DMO in new development work; use SQL Server Management Objects (SMO) instead. You can obtain the SMO documentation by installing SQL Server 2008 R2 Books Online.
Thanks for this.
I looked to find SQLDMO.DLL 64-bit version, but although using the Backwards Comparability package for x64, installing using the MSI did not do the job.
I had to manually extract the files and place the correct version (which is ~2MB larger than the x86 version as an indication to knowing which one is the x64) and then run 'regsvr32 sqldmo.dll ' in the command line (very important: need to run cmd as Administrator for this to succeed).
After the module has been registered, my Access front end run great.

SQL Server 2008 to SQL Server CE (Windows Phone 7)

I'm looking at the possibility of using the tool SQLMetal. I was wondering is there a way I can create a basic DB using SQL Server 2008 and then convert that to a .sdf so I could then use the SQLMetal tool to create the appropriate WP7 classes.
I suggest you use my SQL Server Toolbox add-in (or if you do not have Visual Studio Pro or higher, you can use my command line utilities). The toolbox allows you to script a SQL Server 2008 database and run this script against a SQL Server Compact 3.5 database. The toolbox can also create the DataContext and related classes via a simple GUI. See my blog for more info: http://erikej.blogspot.com

SQL Server 2008 R2 Data Move from One Server to Another

I have the following scenerio:-
1) Server 1 - SQL Server 2008 R2 Express - Collation SQL_Latin1_General_CS_As
2) Server 2 - SQL Server 2008 R2 Standard - Collation SQL_Latin1_General_CI_AS
I want to move the database from Server 1 to Server 2.
I tried backup and restore but does not work may be because of different collation. I also tried export but I'm getting some error. Please help me solving the issue.
The way is to use ssis (dts) wizards or, if the db is small - to do db export-import with data export option with help of data exporting embedded in management studio, and finally - try to do simple detach-attach of db
There is separate Database Publishing Wizard, available for download
Overview
SQL Server Database Publishing Wizard enables the deployment
of SQL Server databases into a hosted environment on either a SQL
Server 2000 or 2005 server. It generates a single SQL script file
which can be used to recreate a database (both schema and data) in a
shared hosting environment where the only connectivity to a server is
through a web-based control panel with a script execution window. If
supported by the hosting service provider, the Database Publishing
Wizard can also directly upload databases to servers located at the
shared hosting provider.
Optionally, SQL Server Database Publishing Wizard can integrate
directly into Visual Studio 2005 and/or Visual Web Developer 2005
allowing easy publishing of databases from within the development
environment.