2

SQL Server Image Table

CREATE TABLE "SqlServerTable" (
    "id" INT NOT NULL,
    "image" IMAGE NOT NULL,
    PRIMARY KEY ("id")
);

MySQL Image Table

CREATE TABLE `MySqlTable` (
    `id` INT NOT NULL,
    `image` LONGBLOB NOT NULL,
    PRIMARY KEY (`id`)
);

What is the difference between image and longblob?

How can convert data from image type in SQL Server to blob type in MySQL?

When I copy data from SQL Server to MySQL, does not show any image with this file_put_contents('2xx.jpg',$MySqlTable['image']);?

I have do special processing on image type SQL Server?

shA.t
  • 16,580
  • 5
  • 54
  • 111
  • 1
    http://stackoverflow.com/questions/6528267/migrating-blob-data-from-ms-sql-server-to-mysql – Gouda Elalfy Jan 12 '16 at 09:20
  • No,i can transform data from sql server to mysql,but when transform data from sqlserver to mysql does not show image because say image binary is not valid fomrmat –  Jan 12 '16 at 09:32
  • this will help you make a migration in a valid way. you shouldn't copy the image field content to longblob in mysql – Gouda Elalfy Jan 12 '16 at 09:34
  • I think you can use a converter program, and don't do it directly – Behzad Hassani Jan 12 '16 at 09:40
  • @BehzadHassani How can do it?and this program What to do؟ –  Jan 12 '16 at 09:50
  • @chatkai I think you can make a little multi thread program to migrate your data, you can use C# for multi thread purpose and it's libraries for connecting to MySQL – Behzad Hassani Jan 12 '16 at 09:53
  • IMHO, you can use storing URL File Links instead - I think this can be a solution for storing an image in multiple DB ;). – shA.t Jan 13 '16 at 05:36
  • [Storing Images in DB - Yea or Nay?](http://stackoverflow.com/q/3748/4519059) ;). – shA.t Jan 13 '16 at 05:41

1 Answers1

2

BLOB in MySQL
BLOB values are treated as binary strings (byte strings). They have no character set, and sorting and comparison are based on the numeric values of the bytes in column values.
The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB. These differ only in the maximum length of the values they can hold.
MySQL Connector/ODBC defines BLOB values as LONGVARBINARY.

image
Variable-length binary data from 0 through 2^31-1 (2,147,483,647) bytes.
image data type will be removed in a future version of Microsoft SQL Server. Use varbinary(max) instead.
Microsoft research: To BLOB or Not To BLOB

IMHO, both are a set of binary data and difference is about how each DBMS stores that set of binary data.
I think a better solution to avoid processing over images, streams and so on is to store URL File Links if there is not any advantage of using in table file data.

shA.t
  • 16,580
  • 5
  • 54
  • 111