1

I have a binary(16) field in a table in MySQL, and I'd like to insert data at the MySQL command prompt into this field. I've tried:

  • inserting numbers (4)
  • inserting a 16-digit long binary string (10100000000000000)

Is there a way to insert this data at the command prompt? When I select binary data from the table in the command prompt, it looks like this: +??VA?:??. But inserting that same data back immediately doesn't work.

1 Answer 1

1

Right, so BINARY data isn't the same as a binary number. Whereas binary numbers is a representation of a number with just zeroes and ones BINARY data is more like raw data. As MySQL puts it

they contain byte strings rather than character strings

They reason it looks like +??VA?:?? is that your terminal cannot correctly represent the BINARY value.

Depending on the data you wish to enter have a look at the functions BINARY and CAST, they might work for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.