Importing old data to new database


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Importing old data to new database

  1. #1
    robert Guest

    Importing old data to new database


    New user

    I have installed sql 7 on a new computer having trouble getting database
    to work with old data
    after installing sql 7 I copies old database to the data dir under MCSQL7
    when I go to enterprise manager I only see default databases
    Do I have to import it ,I thought since its in native format it would be
    recogize it.

  2. #2
    Andrew Prosser Guest

    Re: Importing old data to new database


    "robert" <robert9@telus.net> wrote:
    >
    >New user
    >
    >I have installed sql 7 on a new computer having trouble getting database
    >to work with old data
    >after installing sql 7 I copies old database to the data dir under MCSQL7
    >when I go to enterprise manager I only see default databases
    >Do I have to import it ,I thought since its in native format it would be
    > recogize it.


    SQL Server cannot magically 'pick up' databases because they happen to reside
    in a directory, you need to do the following for each of your databases;

    Detach the datafiles for each of your old databases;

    sp_detach_db my_database_name

    Now copy these files to your new machine.

    In the new server run for each database;

    CREATE DATABASE database_name
    ON PRIMARY (FILENAME = 'c:\my_database_name.mdf')
    FOR ATTACH

    That should be that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center