|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
How can I get data from table to text-file by SQL-commands, for example
SELECT * FROM Table. Result to text-file Table.txt. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Sun, 13 Jan 2008 07:46:39 GMT, "Kaitsu" <Kaitsu@luukku.com> wrote:
>How can I get data from table to text-file by SQL-commands, for example >SELECT * FROM Table. Result to text-file Table.txt. This must be executed at a command prompt, not as a SQL query. bcp.exe "select * from master..sysdatabases" queryout sysdatabases.txt -c -T -t\t -r\n There are many other parameters to consider, in particular -S to specify the server, and -f to specify a format file. Read about it in Books On Line. Roy Harvey Beacon Falls, CT |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
"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 |
|
![]() |
| Outils de la discussion | |
|
|