Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: DTS Wizard may not detect Excel column type for mixed data in SQL Server


Symptoms

When you use the Microsoft SQL Server Data Transformation Services (DTS) Import Wizard to import data from a Microsoft Excel worksheet, if a text column contains data that could be interpreted as mixed data (for example, alphanumeric characters representing hexadecimal data), the initial few rows determine the actual data type used and subsequent rows may be transferred as NULLs. DTS does not provide a warning message to indicate that some rows might not transfer.

Note If you are using SQL Server 2005, use the SQL Server Import and Export Wizard to perform the data transform.

↑ Back to the top


Cause

This behavior is by design for the Excel ISAM. The first 8 rows determine the data type of the column. For example, if most of the first 8 rows contain numeric characters, the datatype of the column is a number. All subsequent values that do not fit that datatype are returned as NULL.

↑ Back to the top


Workaround

One workaround is to save the Excel sheet as a text file and then you use the DTS Wizard to import the file into SQL Server.

↑ Back to the top


More Information

Steps To reproduce the behavior

For example, create the following worksheet in Excel:
DecimalHex
11
22
33
44
55
66
77
88
99
10A
11B
12C
13D
14E
15F
The first column "Decimal" is formatted as General and the second column "HEX" is formatted as Text.

If you load this table from Excel into SQL Server using the DTS Wizard, rows 10-15 (values A-F) are NULL when loaded into a SQL table (the HEX column is formatted as Text in the workbook, but DTS makes it a Float type since it detects the source column as DBTYPE_R8 ).

↑ Back to the top


References

For more information, see the "SQL Server Data Transformation Services" topic in SQL Server Books Online.

↑ Back to the top


Keywords: kbyukonsweep, kbappliestoyukon, kbdatabase, kbdsupport, kbprb, kbbillprodsweep, kb, misc_migrate_32718

↑ Back to the top

Article Info
Article ID : 236605
Revision : 3
Created on : 4/13/2018
Published on : 4/13/2018
Exists online : False
Views : 167