PRB: DTS Wizard "Fixed Field Column Positions" Wraps Text (271247)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q271247

SYMPTOMS

When you use the Data Transformation Services (DTS) Wizard and you import a text file, misleading information appears in the Preview pane for the Fixed Field Column Positions screen or page. If a row in the text file is longer than the fixed length, the left over characters wrap in the Preview pane, which implies improper results.

MORE INFORMATION

Consider a text file that contains the following:
Data1  Data2
Data1  DataXXX
Data1  DataYYY
				
Perform these steps:
  1. Open the DTS Wizard.
  2. Select Text File as the import source, and then point the Wizard to the saved text file.
  3. Select the Fixed Field option button.
  4. Accept the other defaults.
  5. Press Next.
  6. In the Fixed Field Column Positions dialog box, note that the text is wrapped as follows:
    Data1  Data2
    Data1  DataX
    XXData1  Dat
    aYYY 
    					
  7. Place a column break on position 5 (for illustration purposes).
  8. Note that the data is divided by this marker as follows:
         |
    Data1|  Data2
    Data1|  DataX
    XXDat|a1  Dat
    aYYY |
         |
    						
    This seems to imply that after insertion, the result set may appear as follows:
    Col001       Col002
    ---------------------
    Data1        Data2
    Data1        DataX
    XXDat        a1  Dat
    aYYY         (null)
    						
    However, this is not the case. Actually, the data is read in fixed lengths until the end of the text row is reached by the row delimiter. At that point, any data that appears after the fixed length columns (set by the first row of data) is ignored. The next row in the text file does not consider these left over characters. Instead, it is read from the beginning. The result set that would be inserted is as follows:
    Col001       Col002
    ---------------------
    Data1        Data2
    Data1        DataX
    Data1        DataY
    						

Modification Type:MajorLast Reviewed:10/23/2000
Keywords:kbprb KB271247