Tuesday, March 27, 2012

Exporting MSSQL database

Hello all

Before I begin - I have very little experience with SQL and databases in general, so please if you are kind enough to offer your advice, please be kind to break it down, even if it seems obvious to you.

Here is the problem - I am hosting a DotNetNuke website with a certain company, whom I would like to leave. In order to migrate my site to another hosting provider I need a copy of my DB, in a .mdf file format (according to the new hosting provider), which I am unable to get from my current provider, why I do not know, and if truth be told dont' particularly care. Anyways. What can I do? Another problem is that I can only access my existing DB thru hosting provider's web portal, not MSSQL Server Management studio. I have an option to export into .CSV file or .XML file. But what do I do with them after that? Bring it into the studio, save it as .mdf? This all probably sounds really funny, and naive to someone who knows about these things, but I am really frustrated. Many thanks in advance.

Quote:

Originally Posted by yellofsh

Hello all

Before I begin - I have very little experience with SQL and databases in general, so please if you are kind enough to offer your advice, please be kind to break it down, even if it seems obvious to you.

Here is the problem - I am hosting a DotNetNuke website with a certain company, whom I would like to leave. In order to migrate my site to another hosting provider I need a copy of my DB, in a .mdf file format (according to the new hosting provider), which I am unable to get from my current provider, why I do not know, and if truth be told dont' particularly care. Anyways. What can I do? Another problem is that I can only access my existing DB thru hosting provider's web portal, not MSSQL Server Management studio. I have an option to export into .CSV file or .XML file. But what do I do with them after that? Bring it into the studio, save it as .mdf? This all probably sounds really funny, and naive to someone who knows about these things, but I am really frustrated. Many thanks in advance.


Well if you could get into the management studio it'd be easy you just create a backup of the database. Otherwise if you can only save the data in each table in your database to a .csv file then it'll be more tricky depending on how many tables are in the database.

First of all you'll need to brush up on your SQL (don't worry it's easy). Start by creating a new database (CREATE DATABASE myDB), then you'll have to create each table manually and define all the fields (unless the web portal will script the CREATE TABLE statements for you) . Then for each table you'll need to import the data from the .csv file into the table using a BULK INSERT statement.

Once all this is done you have your database and you'll find the .mdf file somewhere in the SQL Server directory.

This is only a rough guide but hope it point you in the right direction.

No comments:

Post a Comment