How to attach an existing SQL Server 2000 Database to SQL Server 2000 Desktop Engine

Article translations Article translations
Article ID: 290623 - View products that this article applies to.
This article was previously published under Q290623
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access project (.adp).

For a Microsoft Access 2000 version of this article, see 208888.
Expand all | Collapse all

SUMMARY

You may have a need to copy an existing database from Microsoft SQL Server 2000 and to place the database on another computer that is running Microsoft SQL Server 2000 Desktop Engine. This article describes how to do so. The process involves temporarily detaching the database from its server, copying the data file (.mdf) and log file (.ldf) to the target computer, and then attaching the files to the SQL Server 2000 Desktop Engine server there.

NOTE: The previous version of Microsoft SQL Server 2000 Desktop Engine is named Microsoft Data Engine (MSDE).

MORE INFORMATION

The following steps demonstrate how to copy the sample pubs database from a computer that is running SQL Server 2000 and how to place it on a computer that is running SQL Server 2000 Desktop Engine:
  1. On the server that is running SQL Server 2000, open SQL Server Query Analyzer, and type the following line:
    sp_detach_db pubs
  2. On the Query menu, click Execute (or press F5) to run the query. Not that you receive a message that indicates that no records were returned.

    NOTE: Temporarily detaching the database from the server allows you to copy the data and log files.
  3. In Windows Explorer, copy Pubs.mdf and Pubs_log.ldf from the Microsoft SQL Server\MSSQL\Data folder on the server to the Microsoft SQL Server\MSSQL\Data folder on the SQL Server 2000 Desktop Engine computer
  4. To attach the files to the SQL Server computer again, run the following statements in the Query Analyzer. Your server's copy of SQL Server may be in a different location than this example; modify the path as needed.
        EXEC sp_attach_db @dbname = 'pubs',
            @filename1 = 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
            @filename2 = 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
    					
  5. Use your copy of SQL Server 2000 Desktop Engine to open any working Access project.
  6. Click Queries, and then click New.
  7. In the New Query dialog box, click Create Text Stored Procedure, and then click OK.
  8. Type the following statements in the new procedure.

    NOTE: Some of the general stored procedure text may already be there. Also, your copy of SQL Server 2000 Desktop Engine may be on a drive other than drive C.
       Create Procedure AttachDB
    
       As
    
       EXEC sp_attach_db @dbname = 'pubs',
    
           @filename1 = 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
           @filename2 = 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
    
       return
    					
  9. Save the stored procedure, and then close it.
  10. Double-click AttachDB to run it. Note that you receive a message that indicates that no records were returned. Click OK.
At this point, the pubs sample database is attached to your installation of SQL Server 2000 Desktop Engine, and you can create new Access projects from it.

Properties

Article ID: 290623 - Last Review: April 6, 2007 - Revision: 5.1
APPLIES TO
  • Microsoft Office Access 2007
  • Microsoft Office Access 2003
  • Microsoft Access 2002 Standard Edition
Keywords: 
kbclientserver kbhowto KB290623

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com