469,927 Members | 1,995 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

blob to float conversion

Dear all,

I am very new in MySQL, I am working on image database project for my
research and I have problem how to convert blob field into float in
MySQL so that I can calculate the blob field with the MATH operation.

Does any one how to do it ????

Thank you very much indeed , for your help.

Regards
yoesufi

Sep 1 '06 #1
1 4556
yoes wrote:
I am very new in MySQL, I am working on image database project for my
research and I have problem how to convert blob field into float in
MySQL so that I can calculate the blob field with the MATH operation.
If I understood you correctly, you have a field in your table and you
want to change the type of this field and at the same time calculate a
different value for it, but use the old value to do so. If so...

To minimize the risk of the data loss, to keep system down as little as
possible and to make it easy, I suggest that you first create a new
field first. Then put the correct value to that field and then remove
the blob and then rename the new field to the name what blob had.
Something like:

alter table yourtablename add newfield float;
update yourtablename set newfield = 1+1; # add correct formula here
# Now is a good place to check that the newfield
# actually has correct values
alter table yourtablename drop blobfield;
alter table yourtablename change newfield blobfield float;

If the database has users 24/7 and you are creating the float value from
always changing data, you should lock the table for that operation to
prevent anyone changing the values while working.

Those commands were written from memory, without checking if they
actually work. Please use with caution.
Sep 2 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jim West | last post: by
14 posts views Thread by Glen Able | last post: by
54 posts views Thread by Andy | last post: by
1 post views Thread by Bruno van Dooren | last post: by
16 posts views Thread by Enekajmer | last post: by
14 posts views Thread by Jim Langston | last post: by
8 posts views Thread by d major | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.