Importing Data Into SQL Server Databases
The Import Data dialog allows you to import both Excel and CSV files in to your SQL Server database.
You can import Excel and CSV files into an existing table or into a new table. If you are importing into an existing table ensure that the total number of columns in the Excel file or CSV file matches the number of columns in the destination table.
The maximum number of columns supported when importing into a new table is 32 columns. Import will create a new table based on the name supplied.
Table columns will be created as nvarchar(2000).
The Import Data dialog
- Import File: If you know the path and name
of the file you wish to import, enter them in the Import File text box. If you are uncertain, click on the browse button to locate the file you wish to import. If an Excel file is chosen, the Excel Sheet
drop down will list the various sheets in the Excel book.
- Excel Sheet: This drop down is enabled when an Excel file is chosen.
Select the sheet you wish to import from the list.
- Server: Displays the Server instance you are connected to. This is a static option and is for informational use only.
- Database: This is a list of all available databases to the current user.
- Import data into a new table: To import
into a new table select this option and enter the table name you wish to
create. Columns will be created based on the number of columns defined in your
import file up to a maximum of 32.
- Import data into an existing table: A list of tables will be available based on the current database selected. If this option is chosen ensure that the destination table selected have the same number of columns as in your import file.
Importing XML Files
The import XML feature uses the three files generated during the XML export.
These files have the same name but different file extensions:
XML: Contains the actual data content of the exported table or view.
XSD: Contains the schema definition of the exported table or view.
TXD: Contains additional schema definition proprietary to Teratrax.
The XSD and TXD files must be kept in the same folder and with the same names
as the XML file in order for Teratrax Database Manager to import the XML file
into a SQL Server database. Do not delete or rename these files. The following
list illustrates the table structure elements that are preserved after importing
XML files:
| Structure Element |
Preserved |
| Data Types |
YES |
| Column Size, Precision, & Scale |
YES |
| Allow Nulls Indicator |
YES |
| Identity Indicator |
YES |
| Collation |
YES |
| Computed Column Indicator |
YES |
| Defaults |
NO |
| ANSI Padding |
NO |
| Rules (Deprecated in SQL Server 2005) |
NO |
| Triggers |
NO |
| Indexes |
NO |
| Primary Keys |
NO |
| Foreign Keys |
NO |
| Unique Constraints |
NO |
| Check Constraints |
NO |
Related Links
Backup and Restore Individual Tables
Using XML
Copy Tables Between SQL Server
Instances
|