我现在知道应该是Select * from 文件名 但是又有个问题,取得的数据不是按Tab分列的,还有如果数据中有双引号,就取不取了。比如象这样的数据就只能取到plmn= ,双引号后的就没有了。
plmn="AXE",bsc="tt",site="s1",ru="G12-TG-276",ru="g"    RU2
plmn="AXE",bsc="y1",site="s2",ru="G12-TG-276",ru="h" RU2

解决方案 »

  1.   

    在ODBC连接方式下使用下面的连接字符:
    DRIVER={Microsoft Text Driver (*.txt; *.csv)};DBQ=***
    后面的***是文本本档的所在文件夹
    这样可以把文件夹当成一个数据库
    而文本文件当作数据表
      

  2.   

    SYMPTOMS
    When you use data access technologies such as Microsoft Data Access Objects (DAO) or Microsoft ActiveX Data Objects (ADO) to open text files that contain a non-standard delimiter (such as a single quotation ), the delimiter appears in the field data. Furthermore, text fields that contain an embedded field separator (such as a comma) do not parse properly.For example, if a text file is formatted as follows: 'Doe, Jane','1 Main St.','Redmond','WA'
    The recordset field data for the first column contains the following text: 'Doe
    and not 'Doe, Jane' as expected. This problem does not occur if you use double quotation s to delimit text fields. 
    CAUSE
    This problem occurs because the Microsoft Jet engine text Indexed Sequential Access Method (ISAM) or Microsoft Text ODBC Driver, which is contained in Odbcjt32.dll or the microsoft.jet.oledb.x.x OLE DB Provider, expects either a double quotation  or no text delimiter at all. If you use double quotation s as the text delimiter in the above-mentioned text file, this parsing problem does not occur. This problem only occurs when you use non-standard text delimiters. 
    RESOLUTION
    To resolve this problem, use one of the following methods: 
    If you use a non-standard text delimiter, you must define the delimiter in the Schema.ini file. For example, in Schema.ini, add the following line:TextDelimiter='
    In Notepad, create a new file in the same directory as the text file, and paste the following text: [MyTextFile.txt]
    ColNameHeader=False
    Format=CSVDelimited
    TextDelimiter='
    NOTE: Make sure that you replace the single quotation  in the following line: TextDelimiter='
    with the delimiter that is used in the text file. Also, insert your particular file name between the square brackets.
      

  3.   

    上面是MSDN中查到的KB205439中的内容
      

  4.   

    如果数据是用逗号隔开的就正常了,可不可以设置成Tab啊。
      

  5.   

    不用的,建个odbc就可以了!但你的txt大概要有一定的格式。
    select * form a.txt 可以选择出a.txt文件里的内容了.注意文件名不能过长,或有非法字符。