If you want to store documents or images in your database, you can write an application that reads the contents of the file into a variable, and supplies that variable as a value for an INSERT statement. See How to use prepared statements, and SET statement.
You can also use the xp_read_file system function to insert file contents into a table. This function is useful if you want to insert file contents from Interactive SQL, or some other environment that does not provide a full programming language.
DBA authority is required to use this function.
In this example, you create a table, and insert an image into a column of the table. You can perform these steps from Interactive SQL.
CREATE TABLE Pictures ( C1 INT DEFAULT AUTOINCREMENT PRIMARY KEY, Filename VARCHAR(254), Picture LONG BINARY );
INSERT INTO Pictures ( Filename, Picture ) VALUES ( 'portrait.gif', xp_read_file( 'portrait.gif' ) );
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|