Search code examples
sqlinsertarraysrdbmsinformix

How to insert Byte[] into the Informix database through the SQL Editor interface


I wonder if there's some way to insert Byte[] in to my database column using the INSERT statement through my SQL Editor.

For example

INSERT INTO Temp (id,name) VALUES(1,'rg_book');

I just wanna to test my data and I don't want to make a user interface (file uploader ,...etc).

How to write this statement?


Solution

  • The CLR Byte array type (Byte[]) maps to a VARBINARY type in Informix DB2. See typing information here.

    If your name field is expecting character data, use the VARBINARY function to convert the data into a binary representation of the string. See here.

    For example:

    INSERT INTO Temp (id, name) VALUES (1, VARBINARY('rg_book'));