How to Attach and Detach a Database

Submitted by admin on

Sometimes you want to transfer or backup your database in SQL Server. When the database is attached you cannot copy/move it to any location. All you have to do is detach it first using SQL Server Management Tools.

Another reason why I write this tutorial is to teach you so that when we finish the Library System project you will be able to switch from my own database to your own database just in case you want to differentiate each of the table.

To attach a database

1. Open SQL Server Management Tools.

2. Right click Database and click Attach.

How to Create Database Relationships

Submitted by admin on

In my previous tutorial I discuss on “How to Add Table to Your Existing Database”. Now, I will explain to you on how to create database relationships between one or more tables. Relationship is very important to prevent data inconsistency in your database. For example, you cannot add record in the related table without first adding a record in the primary table.

A relationship exists when two tables are related using a primary key and a foreign key.

How to Add Table to Your Existing Database

Submitted by admin on

In my previous tutorial I discuss on “How to Create Database in SQL Server 2005 Express Edition”. This time you will learn how to add a table in your “LibSys” database using SQL Server Management Studio.

Since LibSys database may contain several tables, I will only teach you to create at least one table and the rest will be done by executing a script.