Quantcast
Channel: Data Warehousing (DWH) Wiki » CSV
Viewing all articles
Browse latest Browse all 5

Export All Tables of a Microsoft SQL Server Database

$
0
0

When supporting a business intelligence project, such as a data warehouse or data mining project, a common task for database administrators is to provide historical data. This article explains how to export all tables of a Microsoft SQL Server database to flat files (in this case comma separated files) to create an archive of historical data.

A very good tool to use for exporting all data is EMS Data Export for SQL Server which is part of the EMS SQL Management Studio for SQL Server solution. This article covers the tool.

EMS Data Export for SQL Server is a powerful program to export your data quickly from SQL Server databases to any of 19 available formats, including MS Access, MS Excel, MS Word (RTF), HTML, XML, PDF, TXT, CSV, DBF, ODF and others. Data Export for SQL Server includes a wizard, which allows you to set export options for each table visually (destination filename, exported fields, data formats, and much more) and a command line utility to export data from tables and queries in one-touch.

Welcome Page

The welcome page is displayed when EMS Data Export for SQL Server is started:

Select the Next button to start the export process.

Set SQL Server Connection Options

This page allows you to setup the SQL Server connection to the host which provides the database to be exported:

Setup the connection to the host and hit the Next button to continue.

Select Databases and Tables for Data Export

On this screen, you have to select the database and the tables to be exported:

You can also provide the destination directory for the flat files which will be created by this wizard. Select the Next button when done.

Create Queries for Data Export

This dialog allows you to add custom queries, for example to add normalized tables to the export, which is often a requirement in data warehousing:

After defining your custom queries, select the Next button to continue.

Specify Output Data Format to Export

You can specify the data format of the export for each table:

A good practice is to select the Apply to all exported objects option and select the CSV (comma-separated values) format. This format is best for ETL toolsused in data warehousing. In addition, the following file formats are available:

Select Next to continue.

Select Fields to Export and Set Order of Exported Fields

This dialog allows you to select the fields of each table to be included in the export:

For business intelligence projects, you should always Export all fields of all tables. Select the Next button when ready.

Set Export Options for the Selected Objects

Each data format requires specific settings. This page allows you to set the settings for the selected data format (in this case CSV):

As a general guideline, you should Quote Strings, and provide no header or footer. Select the Next button to continue.

Set Base Formats of Data Types

For text files, you have to provide the base formats for common data types:

After setting these base settings, select the Next button to continue.

Set Export Final Options

This dialog allows you to limit the number of records to be exported for each table:

You should select options Apply to all exported objects and Export all records.

Also, if you want to schedule the export task, you should use the Tools / Save Template menu item (next to the help button on the bottom left of the screen) to save the settings. You can use the command line tool for scheduling the export using the Windows Scheduler.

Select Next to continue.

Export Log

When hitting the Export button in the last dialog, the export process is started and shown in the following dialog:

You can save the log file when selecting the Save button:

For buying this tool, check out the EMS web site for the product. You should also check out EMS SQL Management Studio for SQL Server if you’re frequently working with SQL Server databases, for example for developing or other tasks, such as importing data or documenting databases.

If you like this how to document or have an idea for improvement, please leave a comment below.


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images