[AccessD] Query a text file without attach or import

Gustav Brock gustav at cactus.dk
Sun Oct 17 09:56:00 CDT 2004


Hi all

Forgot to note that the use of an alias for the table is beneficial or
even mandatory. 

Note that the first syntax can be modified to:

  SELECT
    NameOfField1,
    NameOfField2
  FROM
    [pics#txt] AS T IN '' [Text;DATABASE=c:\windows\temp;];

In the second syntax the trick is the brackets which force accept of
filenames or foldernames containing spaces.

This should be changed to:

  SELECT
    NameOfFiels1,
    NameOfField2
  FROM
    [Text;DATABASE=c:\windows\temp;HDR=YES].[pics.txt] AS T;

as Access otherwise my remodel the syntax into invalid syntax.

/gustav


> Hi all

> Should you ever need it, you can query a text file directly without
> importing or attaching it first. The trich is to understand that
> Access regards the directory of the text file as a "database":

>   SELECT
>     [pics#txt].Field1,
>     [pics#txt].Field2
>   FROM
>     [pics#txt] IN '' [Text;DATABASE=c:\windows\temp;];

> or:

>   SELECT
>     Field1,
>     Field2
>   FROM
>     [Text;DATABASE=c:\windows\temp;HDR=YES].[pics.txt];


> I should note that - as to my testings - even if you specify HDR=NO,
> Access still reads the first line for the column names.

> These syntax are very handy when you need to read temporary text files
> where you do not wish to attach these at all.




More information about the AccessD mailing list