It is possible to insert binary data in a script sql?

1,659 views
Skip to first unread message

Juan Pablo Gardella

unread,
Jul 26, 2012, 2:05:55 AM7/26/12
to h2-da...@googlegroups.com
I 'm building some tests and I need to populate a table that have a binary data column. So I tried:

insert into Archivo
(id, file, fileName, fechaCreacion)
values
(1,0xff,'file1',CURRENT_TIMESTAMP());

But doesn't work. It is possible insert in a script binary data (to test purposes).

Thanks in advance
Juan

Ryan How

unread,
Jul 26, 2012, 6:11:32 AM7/26/12
to h2-da...@googlegroups.com
You could try a SCRIPT TO command on a database with binary data and see
how it is represented in the script.
> --
> You received this message because you are subscribed to the Google
> Groups "H2 Database" group.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
> h2-database...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.


Thomas Mueller

unread,
Aug 15, 2012, 12:06:41 PM8/15/12
to h2-da...@googlegroups.com
Hi,

This is documented:

->
->
example: X'01FF'

You can also use:

    insert into Archivo (id, file, fileName, fechaCreacion) 
    values(1,'ff','file1',CURRENT_TIMESTAMP());

There is also a system function: http://h2database.com/html/functions.html#file_read

Regards,
Thomas


On Thu, Jul 26, 2012 at 12:11 PM, Ryan How <rh...@exemail.com.au> wrote:
You could try a SCRIPT TO command on a database with binary data and see how it is represented in the script.


On 26/07/2012 2:05 PM, Juan Pablo Gardella wrote:
I 'm building some tests and I need to populate a table that have a binary data column. So I tried:

insert into Archivo
(id, file, fileName, fechaCreacion)
values
(1,0xff,'file1',CURRENT_TIMESTAMP());

But doesn't work. It is possible insert in a script binary data (to test purposes).

Thanks in advance
Juan

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database+unsubscribe@googlegroups.com.

Juan Pablo Gardella

unread,
Aug 15, 2012, 12:08:48 PM8/15/12
to h2-da...@googlegroups.com
Thanks Thomas!! I will test that

Regards,
Juan

2012/8/15 Thomas Mueller <thomas.to...@gmail.com>
To unsubscribe from this group, send email to h2-database...@googlegroups.com.

Juan Pablo Gardella

unread,
Nov 30, 2012, 5:12:18 AM11/30/12
to h2-da...@googlegroups.com
Thanks, this works!!


2012/8/15 Juan Pablo Gardella <gardella...@gmail.com>
Reply all
Reply to author
Forward
0 new messages