Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    12

    Unanswered: Attach Db With Same Files As Existing Db

    In SQL Server 2000, I would like to attach a Database that is the file of the Database on another system. I made a copy of my Client's Database at his site. Now I would like to attach it to my server and then copy the data from my Client's DB to mine.

    The only problem is they have the same file names, so when I try to attach the copy I get an error message. Is there any way to change the name of the data file and log file that a database points to so that I can attach it to my Server?

    Thanks in advance for your help!
    JayD
    Boulder, CO, USA

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Look up RESTORE DATABASE in Books Online. You need to use the WITH MOVE option.

    RESTORE DATABASE database
    WITH
    MOVE 'logical data file' TO 'somenewfile.mdf',
    MOVE 'logical log file' TO 'somenewfile.ldf'

    You can find the name of the files by using: RESTORE FILELISTONLY FROM DISK = 'file.bak'
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •