on 07-26-2017 6:08 PM
Hi! I'm trying to insert a row into my table that is formatted like this:
CREATE TABLE test (COL1 VARBINARY, COL2 VARBINARY)
I tried two insert statements that look like this:
insert into TESTBYTE values(
"b'708ca7fbb701799bb387f2e50deaca402e8502abe229f705693d2d4f350e1ad6'", "b'G\xa2ac\xa0av\xf6'"
);
insert into TESTBYTE values(
CAST('708ca7fbb701799bb387f2e50deaca402e8502abe229f705693d2d4f350e1ad6'ASVARBINARY),
CAST('G\xa2ac\xa0av\xf6'ASVARBINARY)
);
The first one errors out as a syntax error and the second seems to be converting the given string into binary again. Is there any way to do this properly? Thank you!
Hello Anton,
as the documentation says binary strings have to be prefix with an X and the binary value has to be enclosed in single quotes (please check paragraph binary string contants in the documentation).
In addition I think you will not be able to insert your binary value in the table with the current definition. That's because you have not defined a length for the VARBINARY type, so the default is 1 byte (which is to small for the content to be inserted).
Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also discussed on SO...
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.