|
Posted by Chris.Cheney on 01/13/08 09:55
"Kaitsu" <Kaitsu@luukku.com> wrote in news:zljij.17$kS4.0@read4.inet.fi:
> How can I get data from table to text-file by SQL-commands, for example
> SELECT * FROM Table. Result to text-file Table.txt.
>
>
>
From T-SQL, you could use the JET or ACE text-file drivers (if installed):
INSERT INTO OPENDATASOURCE('Microsoft.JET.OLEDB.4.0', 'Data Source=C:
\Documents and Settings\chris\My Documents;Extended
Properties="text;HDR=No"')...[test999#txt] SELECT Name, Comments FROM
Buildings
(but not SELECT ... INTO ... ); the output text file must exist and must
either have a header line, whether or not HDR=Yes or HDR=No, or there must
be a relevant entry in schema.ini. Note that the "." before the extension
in the text-file name must be replaced by "#".
Replace 'Microsoft.JET.OLEDB.4.0' by 'Microsoft.ACE.OLEDB.12.0' to use the
ACE provider (ACE is a free download from MS).
For details of schema.ini, see
http://msdn2.microsoft.com/en-us/library/ms709353.aspx (JET) or
http://msdn2.microsoft.com/en-us/library/bb177651.aspx (ACE)
I believe that it should also be possible to use the ODBC text driver, but
I have no experience of it.
HTH
Navigation:
[Reply to this message]
|