ASA SQL Reference
System Procedures and Functions
System extended stored procedures
Other system extended stored procedures
Writes data to a file from a SQL statement.
[ variable = CALL ] xp_write_file ( filename, file_contents )
DBA authority required
The function writes file_contents to the file filename. It returns 0 if successful, and non-zero if it fails.
The filename is relative to the current working directory of the database server. If the file already exists, its contents are overwritten.
This function can be useful for unloading long binary data into files.
Consider a table t1 that has the following columns:
filename A filename relative to the server.
picture A LONG BINARY column holding an image.
The following statement unloads the pictures into the named files:
SELECT xp_write_file( filename, picture) FROM t1