DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

How are you handling the data revolution? We want your take on what's real, what's hype, and what's next in the world of data engineering.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Monitoring and Managing the Growth of the MSDB System Database in SQL Server
  • Master SQL Performance Optimization: Step-by-Step Techniques With Case Studies
  • Resolving Parameter Sensitivity With Parameter Sensitive Plan Optimization in SQL Server 2022
  • Useful System Table Queries in Relational Databases

Trending

  • How to Test Multi-Threaded and Concurrent Java
  • Deploy Serverless Lambdas Confidently Using Canary
  • CORS Misconfigurations: The Simple API Header That Took Down Our Frontend
  • From Java 8 to Java 21: How the Evolution Changed My Developer Workflow
  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Attach a Pubs Database in SQL Server

How to Attach a Pubs Database in SQL Server

With the Pubs database ready, you can start learning database concepts and programming and attach any database if you have the MDF and LDF files.

By 
Joy Twain user avatar
Joy Twain
·
Updated Nov. 05, 18 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
21.8K Views

Join the DZone community and get the full member experience.

Join For Free

In this tutorial, I will explain how to Attach a Pubs Database in SQL Server. The procedure is the same for every other database to. You will need Pubs MDF and LDF files to attach to your SQL server. 

Note that both Northwind and Pubs databases come together with the download file.

What is Pubs Database

The Pubs Database contains a fictional set of information about:

  1. publishers,
  2. authors,
  3. titles and
  4. the sales of their associated books.

This database is used as a learning tool by Programmers, like fetching information through queries, or through ORM (Object-relational mapping) like Entity Framework Core.   

Installing the Pubs Database

First, download the setup file from the Microsoft Website.

Download Pubs Database

After downloading, you will get a SQL2000SampleDb.msi file (which is a setup file).

msi file

Double-click SQL2000SampleDb.msi to start the setup for Microsoft SQL server 2000 sample database scripts.

Microsoft SQL Server 2000 Sample Database Scripts

Click Next.

You will see the License Agreement window. Select I Agree and click the Next button.

License Agreement Window

Next, you will see the Choose Installation Options window. Click the Next button here, too.

Choose Installation Options

Next, you have to confirm the installation. Click the Next button again.

Confirm Installation Window

The setup procedure will start and soon you will get the Installation Complete message.

Installation Complete Window

The Pubs and Northwind databases will install in the location C:\SQL Server 2000 Sample Databases.

Pubs Database Location

Attach Pubs Database in SQL Server

We now have the Pubs database LDF and MDF files and we are ready to attach them in the SQL server.

In your SQL server’s Object Explorer, right-click the Databases node and select New Database.

New Database in Object Explorer

The Attach Databases window opens and asks for the MDF file, so click the Add button.

Attach Databases Window

Now, you will see the Locate Database Files window. In this window, select PUBS.MDF file (location C:\SQL Server 2000 Sample Databases). Then click the OK button.

Locate Database Files

The Locate Database Files window closes and you will see the Attach Databases window now have the pubs.mdf file location. Click the OK button.

Attaches Databases Window Contains Pubs mdf File Location

The window closes and you will find the Pubs database attached in your SQL server.

Pubs Database

Conclusion

With the Pubs database ready, you can start learning database concepts and programming, such as:

  • How to Perform CRUD Operations in SQL Server

  • CRUD Operations in Entity Framework and ASP.NET MVC

  • CRUD Operations in Entity Framework and ASP.NET

This concludes this tutorial. Now, you can attach any database if you have the MDF and LDF files.

Database sql

Opinions expressed by DZone contributors are their own.

Related

  • Monitoring and Managing the Growth of the MSDB System Database in SQL Server
  • Master SQL Performance Optimization: Step-by-Step Techniques With Case Studies
  • Resolving Parameter Sensitivity With Parameter Sensitive Plan Optimization in SQL Server 2022
  • Useful System Table Queries in Relational Databases

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: