Reads a file and returns the contents of the file as a LONG BINARY variable.
xp_read_file( filename )
filename Use this LONG VARCHAR parameter to specify the name of the file for which to return the contents.
The function reads the contents of the named file, and returns the result as a LONG BINARY value.
The filename is relative to the starting directory of the database server.
The function can be useful for inserting entire documents or images stored in files into tables. If the file cannot be read, the function returns NULL.
If the data file is in a different character set, you can use the CSCONVERT function to convert it. See CSCONVERT function [String].
You can also use the CSCONVERT function to address character set conversion requirements you have when using the xp_read_file system procedure. See CSCONVERT function [String].
DBA authority required
The following statement inserts an image into a column named picture of the table t1 (assuming all other columns can accept NULL):
INSERT INTO t1 ( picture ) SELECT xp_read_file( 'portrait.gif' );
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|