Skip to content

Copying/Transferring Data From One Database to Another

October 16, 2012

On Tuesday it had been  a long haul in development, my main computer just took too long to compile and run the ASP.NET application, so I decided to switch to my laptop to do development.

This meant I had to kept the data up to date on this database on the laptop which turns out to be a bit of a manic pain.

I had hoped that transferring a backup of a SQL SERVER 2008 Database would be a doddle, not quite so with the .bak file, as i had received an error in the Import menu when copying the .bak file using a USB stick.

The error had been similar to “Cannot read SQL Server 2008 database – version increased to 661 from 655″, which meant an unnecessary upgrade for the laptop database, or from what I felt a long procedure to do so.

I had even tried to make a copy of the database and store this in a .mdf file but that didn’t work also!

The only eventual solution I had found for this type of error is to usRight Click – > Tasks – > Import Data and specify the exact data of where it is held either on your PC or local server, and select Use SQL Server Authentication

Make sure though that your database on your laptop being copied to is free from Primary Key selection and identity Specification or the data import will give an error or a type mismatch!! Which I had found out!

Other than that, you need to know further down the line that NHibernate canot run any queries without a Primary Key selected, and preferable Identity Specification so you need to do this manually after the data has been import (sigh!)

For data connections on the web.config, you need to change to: –

<add key=”connection.connection_string” value=”Data Source=LAPTOP\SQLEXPRESS;Initial Catalog=database;Integrated Security=SSPI;”/> if you are likely to use SQLEXPRESS edition on your laptop to get the data running.

So that’s how  I did this to make it work!

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: