Where to download AdventureWorks2008.msi? - sql-server-2008

I'd like to install AdventureWorks2008 (I just install SQL Server 2008 R2 Express).
Each time I download the recommended version from CodePlex, all I get is a AdventureWorks2008.mdf file. Not only I cannot attach the file from SQL Server Management Studio, but I cannot copy/paste the file directly into the the database.
I've read in several places that I need to use AdventureWorks2008.msi, but I cannot find where to download it.
I just cannot figure out how to install AdventureWorks2008
Thanks for helping

There isn't an .msi file for adventureworks, even though you'll find it mentioned in outdated documentation and books. You aren't alone in finding this confusing -- it seems the web site, files and steps Microsoft provides for installing these databases changes every time I need to install them.
You need to create the database and attach the .mdf file, which is the "data file" referred to in the instructions. (.mdf = primary data file, .ldf = log file, .ndf = secondary data file)
In order to attach the file, you need to make sure you carefully follow the steps here: http://social.technet.microsoft.com/wiki/contents/articles/3735.sql-server-samples-readme-en-us.aspx#Readme_for_Adventure_Works_Sample_Databases
Instructions for 2008R2:
To install AdventureWorks2008R2 OLTP database
Download the AdventureWorks2008R2 Data File.
From File Download, click Save and browse to a location on your local
server.
From SQL Server Management Studio, execute the following code:
Case-insensitive Database
CREATE DATABASE AdventureWorks2008R2
ON (FILENAME = '{drive}:\{file path}\AdventureWorks2008R2_Data.mdf')
FOR ATTACH_REBUILD_LOG;
As an alternative to step 3, you can attach the database using the SQL
Server Management Studio user interface. For more detailed
information, see Attach a Database (SQL Server Management Studio).
Note: You must remove the log file from the list of files to attach.
This will cause the operation to rebuild the log.
Headache saving tip from Aaron Bertrand:
You should place the mdf file in your normal data folder - SQL Server
will already have the proper permissions. You can get this path using
SELECT TOP (1) physical_name FROM master.sys.database_files;

You can directly paste that file into your database directory. For more information you can refer http://tryingmicrosoft.com/error-while-attaching-a-database-to-sql-server-2008-r2/.

Related

How to read & update data in the Sql ce database located in Windows phone app data folder?

I have placed the SQL CE Database file in the installation folder of the Windows phone application.i want to perform Read and Write operations on the database but it was saying Access to the database file is not allowed.
Please suggest me how can i achieve this
You need to copy the database to isolated storage on first run, as the installation folder is read-only. You will also need to change the connection string:
data source=isostore://mydb.sdf
See much more in my blog post here: http://erikej.blogspot.dk/2013/04/generate-windows-phone-8-local-database.html

Downgrade mdf file from 661 to 655

I created and database in sql server 2008. I took the mdf and ldf files to Visual Studio 2010 project and tried to connect to that db with entity-framework. and got the following message:
I cannot reinstall or upgrade the software on the specific computer.
So is there any way to downgrade the version of the mdf and ldf files?
No, you cannot downgrade, you will need to move the schema and data another way if you can't install the right version. This recent question is essentially the same:
Failure attaching SQL Server 2008 database to SQL Server 2005
Essentially you can use the Generate Scripts tool or the Export Data wizard to get your destination database to look like the source. You will not be able attach your MDF file.
And this blog post shows some 3rd party tools that can help with this:
http://bertrandaaron.wordpress.com/2012/04/20/re-blog-the-cost-of-reinventing-the-wheel/
No, you need to install the same or newer version of SqlServer.
There is no known way to downgrade an MDF file.
Links
http://blog.sqlauthority.com/2008/10/16/sql-server-downgrade-database-to-previous-version/
Perhaps, if you have access to the SqlServer 2008, you could use the command
"Tasks" -> "Create Scripts" to start the wizard to create a script with schema and data.
On the options page there is the button 'Advanced' where you can select the syntax version of SqlServer
The way that I found that worked was to export the database and stored procedures from the original database. Then upload them into the second database(second computer).
Firstly export the DB content (data) - I used SQL server export data wizard. on the database you wish to export from right click then choose tasks, then export data. Follow the instructions and save in whichever format is best for you - I used excel for the data.
then to export the stored procedures rightclick the database name again. choose tasks and this time choose generate scripts. again follow the instructions of the wizard.
To import the data simply go to the second computer and right click the database you wish to import the data into. again tasks > import data. Follow the instructions to import all of the data from the database.
Finally to import the stored procedures, I opened up a new stored procedures command and dragged and dropped the script file that I had previously saved them in and dropped it into this window. The new stored procedure window filled with the entire list of my stored procedures.
Finally change the name of the database name that will be used by the SP ( if this is different from the original DB name). (This is the first line USE [DBName].
then simply execute and the SP's will be fully restored.
This has helped me get my entire database up and running again very quickly.
Hope this helps.
U can open it on another pic and then publish it to sql script with or without data then create database on target PC using sqlcmd or anything. Then run sql script...

Restore SQL database from disc copy backup

I have managed to drop an SQL express 2008 database, that I accessed using SQL Management studio.
I don't have a backup of the database created through Management Studio or SQL, but I do have a disc copy of my entire c: drive made prior to a machine rebuild 4 weeks ago (A previous installation of the dropped database did exist at this stage). The disc backup contains all the databases (2) and versions, that I require.
Can I restore the databases from copies of raw files form a backup disc? If so is this complicated?
Which files would I need to be copy and to where?
Thanks in advance. Your help is appreciated.
Should be pretty easy:
(if needed) re-install SQL Server (Express) - you should make sure to install the version with the Management Studio
Copy the "raw" files (*.mdf and *.ldf) to the default data directory
In SQL Server Management Studio (Express), in the Object Explorer, go to the Database node and right-click and pick Attach...
Find your *.mdf file in question and select it
That should be all there is!
If you have the old .mdf and .ldf files you can use the "attach database" option rather than restore.

How do I convert files .mdf & .ldf to mysql format

I'm not familiar with these files .MDF & .LDF. I want to convert both to MySQL format or .CSV.
Let me know how can be done. Any tools or scripts can convert it.
They're both SQL Server files. MDF is a database file, and LDF is a transaction log file.
The way to extract data from them is by attaching them to an instance of SQL Server. If the database file is smaller than 5GB, you can attach it to the free edition. If not, you'll need a real version of SQL Server.
The version of SQL Server has to match the version that you got the MDF file from. Sometimes, a newer server version can read an older MDF, but don't count on it.
Once you've got the database attached, you can generate a CSV file in many ways. One easy way is to "Save Results As" from SQL Server Management Studio.
You don't
You have to attach them to a SQL Server Instance and then use of of the Wizards. or import from a MySQL instance-

How to import a SQL Server .bak file into MySQL?

The title is self explanatory. Is there a way of directly doing such kind of importing?
The .BAK files from SQL server are in Microsoft Tape Format (MTF) ref: http://www.fpns.net/willy/msbackup.htm
The bak file will probably contain the LDF and MDF files that SQL server uses to store the database.
You will need to use SQL server to extract these. SQL Server Express is free and will do the job.
So, install SQL Server Express edition, and open the SQL Server Powershell. There execute sqlcmd -S <COMPUTERNAME>\SQLExpress (whilst logged in as administrator)
then issue the following command.
restore filelistonly from disk='c:\temp\mydbName-2009-09-29-v10.bak';
GO
This will list the contents of the backup - what you need is the first fields that tell you the logical names - one will be the actual database and the other the log file.
RESTORE DATABASE mydbName FROM disk='c:\temp\mydbName-2009-09-29-v10.bak'
WITH
MOVE 'mydbName' TO 'c:\temp\mydbName_data.mdf',
MOVE 'mydbName_log' TO 'c:\temp\mydbName_data.ldf';
GO
At this point you have extracted the database - then install Microsoft's "Sql Web Data Administrator". together with this export tool and you will have an SQL script that contains the database.
MySql have an application to import db from microsoft sql.
Steps:
Open MySql Workbench
Click on "Database Migration" (if it do not appear you have to install it from MySql update)
Follow the Migration Task List using the simple Wizard.
I did not manage to find a way to do it directly.
Instead I imported the bak file into SQL Server 2008 Express, and then used MySQL Migration Toolkit.
Worked like a charm!
In this problem, the answer is not updated in a timely. So it's happy to say that in 2020 Migrating to MsSQL into MySQL is that much easy. An online converter like RebaseData will do your job with one click. You can just upload your .bak file which is from MsSQL and convert it into .sql format which is readable to MySQL.
Additional note: This can not only convert your .bak files but also this site is for all types of Database migrations that you want.
Although my MySQL background is limited, I don't think you have much luck doing that. However, you should be able to migrate over all of your data by restoring the db to a MSSQL server, then creating a SSIS or DTS package to send your tables and data to the MySQL server.
hope this helps
I highly doubt it. You might want to use DTS/SSIS to do this as Levi says. One think that you might want to do is start the process without actually importing the data. Just do enough to get the basic table structures together. Then you are going to want to change around the resulting table structure, because whatever structure tat will likely be created will be shaky at best.
You might also have to take this a step further and create a staging area that takes in all the data first n a string (varchar) form. Then you can create a script that does validation and conversion to get it into the "real" database, because the two databases don't always work well together, especially when dealing with dates.
The method I used included part of Richard Harrison's method:
So, install SQL Server 2008 Express
edition,
This requires the download of the Web Platform Installer "wpilauncher_n.exe"
Once you have this installed click on the database selection ( you are also required to download Frameworks and Runtimes)
After instalation go to the windows command prompt and:
use sqlcmd -S \SQLExpress (whilst
logged in as administrator)
then issue the following command.
restore filelistonly from
disk='c:\temp\mydbName-2009-09-29-v10.bak';
GO This will list the contents of the
backup - what you need is the first
fields that tell you the logical names
- one will be the actual database and the other the log file.
RESTORE DATABASE mydbName FROM
disk='c:\temp\mydbName-2009-09-29-v10.bak' WITH MOVE 'mydbName' TO
'c:\temp\mydbName_data.mdf', MOVE
'mydbName_log' TO
'c:\temp\mydbName_data.ldf'; GO
I fired up Web Platform Installer and from the what's new tab I installed SQL Server Management Studio and browsed the db to make sure the data was there...
At that point i tried the tool included with MSSQL "SQL Import and Export Wizard" but the result of the csv dump only included the column names...
So instead I just exported results of queries like "select * from users" from the SQL Server Management Studio
SQL Server databases are very Microsoft proprietary. Two options I can think of are:
Dump the database in CSV, XML or similar format that you'd then load into MySQL.
Setup ODBC connection to MySQL and then using DTS transport the data. As Charles Graham has suggested, you may need to build the tables before doing this. But that's as easy as a cut and paste from SQL Enterprise Manager windows to the corresponding MySQL window.
For those attempting Richard's solution above, here are some additional information that might help navigate common errors:
1) When running restore filelistonly you may get Operating system error 5(Access is denied). If that's the case, open SQL Server Configuration Manager and change the login for SQLEXPRESS to a user that has local write privileges.
2) #"This will list the contents of the backup - what you need is the first fields that tell you the logical names" - if your file lists more than two headers you will need to also account for what to do with those files in the RESTORE DATABASE command. If you don't indicate what to do with files beyond the database and the log, the system will apparently try to use the attributes listed in the .bak file. Restoring a file from someone else's environment will produce a 'The path has invalid attributes. It needs to be a directory' (as the path in question doesn't exist on your machine).
Simply providing a MOVE statement resolves this problem.
In my case there was a third FTData type file. The MOVE command I added:
MOVE 'mydbName_log' TO 'c:\temp\mydbName_data.ldf',
MOVE 'sysft_...' TO 'c:\temp\other';
in my case I actually had to make a new directory for the third file. Initially I tried to send it to the same folder as the .mdf file but that produced a 'failed to initialize correctly' error on the third FTData file when I executed the restore.
The .bak file from SQL Server is specific to that database dialect, and not compatible with MySQL.
Try using etlalchemy to migrate your SQL Server database into MySQL. It is an open-sourced tool that I created to facilitate easy migrations between different RDBMS's.
Quick installation and examples are provided here on the github page, and a more detailed explanation of the project's origins can be found here.