Saturday, February 25, 2012

BLOB as primary key

In SQL Server, Can you set a BLOB field as the primary key? Also in mySQL?
Thanks
Jack
BLOBs in SQL Server are usually stored in columns with datatype image, and
you can't create a Primary Key on a column with datatype image. You can use
varbinary as the datatype for your blob column, but you will be limited to
900 bytes as the maximum length.
MySQL might allow it. Data integrity is not a major concern with the
designers of MySQL. Don't be surprised that if MySQL does allow you to
create a Primary Key on a BLOB, it might actually only create a Primary Key
on the first 100 bytes or so of the BLOB, without notifying you that it does
this.
Jacco Schalkwijk
SQL Server MVP
"Jacky Luk" <jl@.knight.com> wrote in message
news:OgmyIMaKEHA.2456@.TK2MSFTNGP12.phx.gbl...
> In SQL Server, Can you set a BLOB field as the primary key? Also in mySQL?
> Thanks
> Jack
>

No comments:

Post a Comment