Does anyone know the most effective way of storing files in an MS SQL database? I typically use MySQL and use the BLOB field. Is this the correct method in MS SQL as well?
Image type (SQL2000), image or varbinary(MAX) (SQL2005).
Method itself is correct, though CLOB/BLOB support in MSSQL2k is kind of clumsy - and there are endless discussions about whether keeping binaries in a relational database is worth a trouble or not.
------ "There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
So it's possible to use the image datatype in MS SQL to store binary data, but is that only good for images? Would it work for PDF or XLS files? If so, do you need to store the MIME type in a separate field?
> So it's possible to use the image datatype in MS SQL to store binary data, but is that only good for images?
"image" is kind of misleading - that data type accepts binary data of any kind.
> If so, do you need to store the MIME type in a separate field?
Yes, and size and original filename all other metadata.
------ "There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.