database export
Posted in 2000
Topics: SQL Development & Query Writing, Security, Permissions & Auditing
Is it possible to give the informix server a sql query and write the
output to a flat file?
Let say the select statement is as follows:
select id, username, password
from login
where username MATCHES 'alec*'
and have it export the results to /dboutput/alec
and look something like
id|username|password
or with data, it might look like
1213|alec|234lkAf#
3402|alecg|fA3l
Thanks,
-Alec
Sent via Deja.com http://www.deja.com/
Before you buy.
Use SQL UNLOAD to accomplish.
Usage:
UNLOAD TO <Flat File> DELIMITER "|"
SELECT id, username, password FROM login
WHERE username MATCHES "alec*"
Result will be exactly as you have expected.
Rgds
biggiealec@my-deja.com wrote:
> Is it possible to give the informix server a sql query and write the
> output to a flat file?
>
> Let say the select statement is as follows:
>
> select id, username, password
> from login
> where username MATCHES 'alec*'>
> and have it export the results to /dboutput/alec
>
> and look something like
>
> id|username|password
>
> or with data, it might look like
>
> 1213|alec|234lkAf#
> 3402|alecg|fA3l
>
> Thanks,
>
> -Alec
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Hi!
Like
unload to "myfile.out" select a,b,c from mytable where ......
HTH
Michael
biggiealec@my-deja.com wrote:
> Is it possible to give the informix server a sql query and write the
> output to a flat file?
>
> Let say the select statement is as follows:
>
> select id, username, password
> from login
> where username MATCHES 'alec*'>
> and have it export the results to /dboutput/alec
>
> and look something like
>
> id|username|password
>
> or with data, it might look like
>
> 1213|alec|234lkAf#
> 3402|alecg|fA3l
>
> Thanks,
>
> -Alec
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
biggiealec@my-deja.com wrote:
>
> Is it possible to give the informix server a sql query and write the
> output to a flat file?
>
> Let say the select statement is as follows:
>
> select id, username, password
> from login
> where username MATCHES 'alec*'>
> and have it export the results to /dboutput/alec
>
> and look something like
>
> id|username|password
>
> or with data, it might look like
>
> 1213|alec|234lkAf#
> 3402|alecg|fA3l
In dbaccess, isql, or Jonathan Leffler's sqlcmd use:
unload to /dboutput/alec
select id, username, password
from login
where username MATCHES 'alec*';
The filename may optionally be quoted if it contains special characters.
Art S. Kagel
Hi,
If you just want to export it to a text file, try the UNLOAD statement.
If you want to export it to another table in some other database, try
WinSQL professional at http://www.imranweb.com/freesoft
Regards,
biggiealec@my-deja.com wrote:
> Is it possible to give the informix server a sql query and write the
> output to a flat file?
>
> Let say the select statement is as follows:
>
> select id, username, password
> from login
> where username MATCHES 'alec*'>
> and have it export the results to /dboutput/alec
>
> and look something like
>
> id|username|password
>
> or with data, it might look like
>
> 1213|alec|234lkAf#
> 3402|alecg|fA3l
>
> Thanks,
>
> -Alec
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.