The following steps demonstrate how to copy the sample pubs database from a computer running SQL Server 7.0 and how to place it on a computer running MSDE:
-
On the server running SQL Server 7.0, open SQL Server Query Analyzer, and type the following line:
sp_detach_db pubs
-
On the Query menu, click Execute (or press F5) to run the query. Not that you receive a message indicating that no records were returned.
NOTE: Temporarily detaching the database from the server allows you to copy the data and log files.
-
In Windows Explorer, copy Pubs.mdf and Pubs_log.ldf from the mssql7\data folder on the server to the mssql7\data folder on the MSDE computer.
-
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:\mssql7\data\pubs.mdf',
@filename2 = 'c:\mssql7\data\pubs_log.ldf'
Use your copy of MSDE to open any working Access project.
- Click Stored Procedures, and then click New.
- Type the following statements in the new procedure.
NOTE: Some of the general stored procedure text may already be there.
Also, your copy of MSDE may be on a drive other than drive C.
Create Procedure AttachDB
As
EXEC sp_attach_db @dbname = 'pubs',
@filename1 = 'c:\mssql7\data\pubs.mdf',
@filename2 = 'c:\mssql7\data\pubs_log.ldf'
return
- Save the stored procedure, and then close it.
- Double-click AttachDB to run it. Note that you receive a message indicating that no records were returned. Click OK.
At this point, the pubs sample database is attached to your installation of MSDE, and you can create new Access projects from it.