Converting SQLBase Databases to Microsoft Access



Similar documents
Introduction to Microsoft Access 2003

MICROSOFT OUTLOOK 2010 WORK WITH CONTACTS

Using SQL Server Management Studio

Creating a Participants Mailing and/or Contact List:

General User/Technical Guide for Microsoft Access

Microsoft Access 2007 Advanced Queries

Personal Geodatabase 101

Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries

Microsoft Access 2007

Downloading RIT Account Analysis Reports into Excel

MICROSOFT ACCESS TABLES

MICROSOFT ACCESS 2007 BOOK 2

Time Tracking Software For Personal or Business Use

Microsoft Access 2000

Topic: Relationships in ER Diagram and Relationships in MS Access

Using Delphi Data with Excel and Access

Reduced Quality Sample

MICROSOFT ACCESS 2003 TUTORIAL

Microsoft Access Rollup Procedure for Microsoft Office Click on Blank Database and name it something appropriate.

Step One. Step Two. Step Three USING EXPORTED DATA IN MICROSOFT ACCESS (LAST REVISED: 12/10/2013)

MicroStrategy Desktop

Step Sheet: Creating a Data Table and Charts

Adobe Acrobat: Creating Interactive Forms

Unit 10: Microsoft Access Queries

Microsoft Office 2010

INTRODUCTION TO MICROSOFT ACCESS MINIMAL MANUAL

Microsoft Access Basics

Hands-on training in relational database concepts

Lesson 07: MS ACCESS - Handout. Introduction to database (30 mins)

Planning and Creating a Custom Database

IST 195 Lab 11: MS Access

Creating a Database in Access

A Basic introduction to Microsoft Access

Create a New Database in Access 2010

Microsoft Access 2007 Module 1

Creating Tables ACCESS. Normalisation Techniques

CONTENTS MANUFACTURERS GUIDE FOR PUBLIC USERS

Adobe Acrobat 9 Pro Accessibility Guide: Creating Accessible Forms

MICROSOFT ACCESS A. CREATING A DATABASE B. CREATING TABLES IN A DATABASE

Class Scheduler Queries: Navigation and Directions for Creating a Query and a Report in Excel

2. Unzip the file using a program that supports long filenames, such as WinZip. Do not use DOS.

In this example, Mrs. Smith is looking to create graphs that represent the ethnic diversity of the 24 students in her 4 th grade class.

Microsoft Access 2010 handout

Outlook Operating Instructions. Internal Desktop Access

Microsoft Excel Introduction to Microsoft Excel 2007

Access Part 2 - Design

Relational Schema. CS 4700/6700 A Sample of Small Database Design Using Microsoft Access

Moving Data Between Access and Excel

Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide

Distribution List Manager User s Manual

Excel Spreadsheet Activity Redo #1

Creating Database Tables in Microsoft SQL Server

Merging Labels, Letters, and Envelopes Word 2013

Ken Goldberg Database Lab Notes. There are three types of relationships: One-to-One (1:1) One-to-Many (1:N) Many-to-Many (M:N).

Activities/ Resources for Outcome #7

Working together with Word, Excel and PowerPoint

Business Insight Report Authoring Getting Started Guide

Importing TSM Data into Microsoft Excel using Microsoft Query

Word 2003 Tables and Columns

Introduction to Microsoft Access 2010

Using Microsoft Excel to Analyze Data

Getting Started With Microsoft Access

Tutorial 3. Maintaining and Querying a Database

Microsoft Office 2010

MS Excel. Handout: Level 2. elearning Department. Copyright 2016 CMS e-learning Department. All Rights Reserved. Page 1 of 11

DataPA OpenAnalytics End User Training

Introduction to Access97 (2): Relationships. by Robin Beaumont. Contents 2. LEARNING OUTCOMES CHECK LIST FOR THE SESSION INTRODUCTION...

MICROSOFT OUTLOOK 2011 READ, SEARCH AND PRINT S

Introduction to Microsoft Access 2013

Using FileMaker Pro with Microsoft Office

Module One: Getting Started Opening Outlook Setting Up Outlook for the First Time Understanding the Interface...

Microsoft Access 2010 Overview of Basics

Advanced Database Concepts Using Microsoft Access

Word 2010: Mail Merge to with Attachments

Using an Access Database

A database is a collection of data organised in a manner that allows access, retrieval, and use of that data.

Developing Web Applications for Microsoft SQL Server Databases - What you need to know

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt

Creating Personal Web Sites Using SharePoint Designer 2007

APPLYING BENFORD'S LAW This PDF contains step-by-step instructions on how to apply Benford's law using Microsoft Excel, which is commonly used by

File Manager Pro User Guide. Version 3.0

Access Database Design

Web Intelligence User Guide

Planning and Managing Projects with Microsoft Project Professional 2013

How to Back Up and Restore an ACT! Database Answer ID 19211

IENG2004 Industrial Database and Systems Design. Microsoft Access I. What is Microsoft Access? Architecture of Microsoft Access

CONTACTS SYNCHRONIZER FOR IPAD USER GUIDE

Crystal Reports Payroll Exercise

Check out our website!

Lab 2: MS ACCESS Tables

Creating a Distribution List from an Excel Spreadsheet

Database File. Table. Field. Datatype. Value. Department of Computer and Mathematical Sciences

Windows XP File Management

Using Microsoft Access

Microsoft Access 2010 Part 1: Introduction to Access

Steps to Create a Database

PeopleSoft Compare Process

ICDL Module 5: David Varley

Transcription:

for Environmental Management of Military Lands Converting SQLBase Databases to Microsoft Access By William Sprouse CEMML CENTER FOR ENVIRONMENTAL MANAGEMENT OF MILITARY LANDS Colorado State University Fort Collins, CO 80523-1490 August 2004

Converting SQLBase Databases To Microsoft Access By William Sprouse Center for Environmental Management of Military Lands Colorado State University 1490 Campus Delivery Fort Collins, C) 80523-1490 (970) 491-2748

This document was produced under the Land Condition Trend Analysis (LCTA) Technical Support for the U.S. Army Environmental Center (AEC) contract; contract number DAAD13-00-D-5003-0041, task order number CS01-SC-03-016.

1 Introduction 1 1.1 Exporting Data from SQLBase 1 1.2 Importing Data into Microsoft Access 4 1.3 Checking Data Field Properties in SQLBase 5 1.4 Checking Data Field Properties in Microsoft Access 6 1.5 Checking for Primary Keys in SQLBase 7 1.6 Defining Primary Keys in Microsoft Access 8 1.7 Checking the Foreign Keys in SQLBase 9 1.8 Defining Foreign Keys in Microsoft Access 10 1.9 Conclusion 13

1 Introduction When LCTA was originally developed a standard database management system was selected to store the data collected by LCTA. The database selected was SQLBase by Gupta. Since then many new database tools have become available. Some of these new tools are packaged with complete office software solutions and are now very popular. Microsoft Access, for example, has risen to the forefront of popularity in the database arena and many installations have converted their databases to Microsoft Access. Some major reasons for this transition are: The Microsoft Office suite of software is often an installation standard Favorable reviews of Microsoft Access Ease of use Interoperability with other software This document is intended to assist the reader with converting their LCTA databases from SQLBase to Microsoft Access. 1.1 Exporting Data from SQLBase Quest is a Windows user interface supplied with SQLBase to allow management of SQLBase databases. The following section explains the steps required to export data from SQLBase using Quest. Start Quest and connect to the database. To connect to a database select Utilities / Database / Add from the main menu and select the database from the resulting dialog box. Figure 1 shows that Quest has been connected to the LCTAJUS database. 1

Figure 1: Quest Window The first step in converting a SQLBase database is to export the data in the database to a dbase format. 1. Click the Open button on the toolbar. 2. Click the Table button on the toolbar. 3. Select the table from the resulting dialog box. 4. Select Edit / Copy To from the main menu (Figure 2). 5. Select dbase in the List Files of Type list box (Figure 3). 6. Select a directory for the output file. 7. When the export is complete a message will be displayed in the lower left corner of the Quest window. 8. Close the table. 9. Repeat the steps above for each table in the database. 2

Figure 2: Saving a table to a dbase file. Figure 3: Quest copy data to a file dialog box. 3

1.2 Importing Data into Microsoft Access After saving the data in the SQLBase database to dbase files Microsoft Access is used to import the data. Start Microsoft Access and create a new blank database. Import the data from the files by performing the following steps: 1. Select File / Get External Data / Import from the main menu. 2. Select dbase IV (*.dbf) in the Files of type list box (Figure 4). 3. Navigate to the directory containing the exported dbase files and select a file. 4. Click the Import button. 5. A dialog box will appear when the import is done. 6. Repeat steps 3-5 above until all files are imported. Figure 4: Microsoft Access import dialog box. The imported tables will now appear in the database window under the tables section (Figure 5). 4

Figure 5: Microsoft Access database window. 1.3 Checking Data Field Properties in SQLBase When data is imported in this manner only the data field names, data type, and the table data are imported. Table relationships and some data field properties are not imported. The properties of each data field in SQLBase are stored in the system table SysColumns. To view this information query that table using Quest. 1. Click the New button on the toolbar. 2. Click the SQL button on the toolbar. 3. Type the following in the SQL window: select tbname, name, coltype, length, nulls from syscolumns where tbname not like 'SYS%' order by tbname, colno; 4. Select SQL / Execute SQL Statement from the main menu. 5. The result will be shown in the SQL window below the SQL statement, which can be printed by selecting File / Print from the main menu. The SQL statement that was used above will return the table name, data field name, data type, length of the field, and the nullity rule for all tables in the database that are not system tables. All system table names in SQLBase begin with SYS. The resulting data from the query is sorted by table name and the order of the data field in the table. 5

1.4 Checking Data Field Properties in Microsoft Access The data field properties obtained from the steps in the previous section need to be compared to the information for each table in Access. To view the properties of a table select a table in the database window and click the Design button on the database window toolbar (Figure 5). Properties for each data field in the table are shown in the properties window (Figure 6). Next to each data field name is the data type. The data type can be changed my clicking on the data type field and selecting the desired type from the list box. Further information for each data field is shown in the lower left portion of the window. The information shown is for the currently active data field. To change the active data field click on a data field name. Figure 6: Microsoft Access table properties. In most cases the field size only needs to be checked for text data fields. Text fields are listed as CHAR and field size is listed as length in the query results from section 1.3 6

above. The nullity rule from Quest, listed under the nulls column of the Quest output, designates if a data field can contain nulls. If a data field can be left blank the nullity rule will be Y. If a data field requires a value then N will be shown. This information relates to the required field in the table property window in Access. Setting the Required field to No in Access is the same as the nullity rule in Quest of Y. If the nulls column of the Quest output is Y this means nulls are allowed or data is not required. The nullity rule information is not imported into Access from dbase files. 1.5 Checking for Primary Keys in SQLBase Referential integrity constraints are utilized to ensure data integrity in a database. These constraints are defined between a parent table and a child table by defining primary and foreign keys. A parent is defined with a data element, or set of elements, as a primary key. The primary key is a unique value, or set of values, that constrain the entry of data into the dependent child table. For example, PLOTMAST is a parent table to PLOTSURV with PLOTID as the primary key in PLOTMAST and the foreign key in PLOTSURV. If a particular value for PLOTID does not exist in PLOTMAST data for that plot can not be added to the PLOTSURV table. The primary keys of each table are stored in the system table SysPKConstraints. To view this information query that table using Quest. 1. Click the New button on the toolbar. 2. Click the SQL button on the toolbar. 3. Type the following in the SQL window: select name, colname from syspkconstraints order by name, pkcolseqnum; 4. Select SQL / Execute SQL Statement from the main menu. 5. The result will be shown in the SQL window below the SQL statement (Figure 7), which can be printed by selecting File / Print from the main menu. 7

Figure 7: Primary key query results in Quest. In the example shown in Figure 7 the table BIRDSURV has a primary key which contains three data fields; PLOTID, RECDATE and PERIOD. The primary key of the table MATED_STATUS only has the data field MATED_STATUS as its primary key. 1.6 Defining Primary Keys in Microsoft Access Use the information from the previous section to set the primary keys of the imported tables in Access. In Access, the primary key of a table is defined in the table properties window (Figure 6). Display the properties window for a table as described above. Select the data field that will become the primary key by clicking on the box to the left of the data field name, which will highlight the entire row for that data field. If a primary key contains multiple data fields, hold down the Ctrl key while clicking the boxes. To define the selected data fields as the primary key of the table click the key button in the toolbar (Figure 8). A key will now be displayed to the left of each data field name that will become the primary key. Close the properties window, select Yes when prompted to save the changes. Figure 8: Microsoft Access table properties toolbar. 8

1.7 Checking the Foreign Keys in SQLBase The foreign keys of each table are stored in the system table SysFKConstraints. To view this information query that table using Quest. 1. Click the New button on the toolbar. 2. Click the SQL button on the toolbar. 3. Type the following in the SQL window: select name, refscolumn, refdtbname, refdcolumn from sysfkconstraints order by name, fkcolseqnum; 4. Select SQL / Execute SQL Statement from the main menu. 5. The result will be shown in the SQL window below the SQL statement (Figure 9), which can be printed by selecting File / Print from the main menu. Figure 9: Foreign key query results in Quest. In the example shown in Figure 9 the AERCOVER table contains the foreign keys PLOTID and RECDATE which are joined to the PLOTSURV table data fields PLOTID and RECDATE. PLOTSURV is a parent table to the child table AERCOVER. 9

1.8 Defining Foreign Keys in Microsoft Access Use the information from the previous section to define relationships between tables in Access. In Access relationships are defined in the relationships window. Follow the steps below to view the relationships window. 1. Select Tools / Relationships from the main menu. 2. Hold down the Ctrl key and select each table from the Show Table dialog ( Figure 10) that requires relationships. 3. The relationships window will open displaying all of the selected tables ( Figure 11). 4. If a table needs to be added to the relationships window select Relationships / Show Table from the main menu and select the table. Figure 10: Microsoft Access show table dialog. 10

Figure 11: Microsoft Access relationships window. Each rectangle in Figure 11 represents a table. For each table the data field names are listed. Data fields that are part of the primary key are shown in bold. Relationships will be defined between the parent table and the child table using the following steps. 1. Starting with the parent table, the table containing the primary key of the relationship, select the data fields of the primary key. If the primary key contains multiple data fields hold down the Ctrl key while selecting the data field names. 2. While holding down the right mouse button drag the cursor over the child table and release the mouse button. A dialog box similar to Figure 12 will appear. If the primary key only has one data field the values in the Table/Query and Related Table/Query columns will be filled in. If the primary key contains multiple data fields this information will have to be selected. Under the Related Table/Query column select the data field that corresponds to the data field listed under the Table/Query column. In the example shown in Figure 12 the data fields PLOTID and RECDATE of the PLOTSURV table (parent table) are joined to the PLOTID and RECDATE data fields of the GNDCOVER table (child table). Finally, click the Enforce Referential Integrity check box and click the Create button. 11

Figure 12: Microsoft Access edit relationships dialog. Repeat the steps above for all relationships. When a relationship is defined lines will be drawn between the parent and child tables to represent the relationship (Figure 13). Information about a defined relationship can be seen by double clicking the line that connects two tables. Figure 13: Microsoft Access relationships dialog showing defined relationships. 12

1.9 Conclusion Table 1 below outlines the steps required to convert a SQLBase database to Microsoft Access. For each process the section number of this document that describes the process is listed. Table 1: Steps required to convert a SQLBase database to Microsoft Access. Step Process Section 1 Export Data from SQLBase 1.1 2 Import Data into Microsoft Access 1.2 3 Check Data Field Properties in SQLBase 1.3 4 Check Data Field Properties in Microsoft 1.4 Access 5 Check for Primary Keys in SQLBase 1.5 6 Define Primary Keys in Microsoft Access 1.6 7 Check for Foreign Keys in SQLBase 1.7 8 Define Foreign Keys in Microsoft Access 1.8 Once the data has been imported, table properties checked, and relationships defined the conversion process is complete. Before deleting the original SQLBase database and the corresponding software make sure the database conversion was successful. 13