How to set a delimiter when importing from a text source

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Felipe Castro

    #1

    How to set a delimiter when importing from a text source

    Hi all,

    I am importing from a text file using the following statement:

    SELECT * FROM
    [Text;FMT=Delimi ted;HDR=Yes;DAT ABASE=C:\Direct oryPa th\;].[FileName#txt];

    I want to set the delimiter of the file, for instance a semicolon, and I do not know how to do it. I have tried with the following statements, but without good results.

    1. SELECT * FROM
    [Text;FMT=Delimi ted(;);HDR=Yes; DATABASE=C:\Dir ectoryPa th\;].[FileName#txt];

    2. SELECT * FROM[Text;FMT=Delimi ted";";HDR=Yes; DATABASE=C:\Dir ectoryPa th\;].[FileName#txt];

    Any advice will be very helpful.

    Thanks in advance,

    Felipe.
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Your only options I think are to either change the registry (which I wouldn't advise) or to create a schema.ini file in the same folder as the text file you are importing.

    ERLANDSEN DATA CONSULTING The format of a text file is determined by using a schema information file. The schema information file, which is always named Schema.ini and always kept in the same folder as the text data source, provides information about the general format of the file, the column name and data type information, and a number of other data characteristics .

    Example Schema.ini file for a file named filename.txt containing semicolon delimited data with column names in the first row:
    [filename.txt]
    Format=Delimite d(;)
    ColNameHeader=T rue
    MaxScanRows=0
    CharacterSet=AN SI

    Comment

    Working...