Storing text and image | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Storing text and image

I like to store the text and image that are originally from a Word document in a SQL 2K5 database. What is the best way to accomplish that? Usually I would store the image seperately as a external file. In this project, I like to keep the text and image together since I am only talking about 500 records and their size is not big. I don’t want to store the text and image seperately for lesser maintenance. Any input is very much appreicated. wingman
If the size is not big and the count is constant then why not use them inside the database, I don’t see any problem. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
See if this helps:http://research.microsoft.com/research/pubs/view.aspx?type=technical report&id=1089
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
Thank for the quick response. That’s what I am trying to ask. I like to store them in the database, what data type I can use and is there any speical coding I need to do to display them correctly in a web browser?
quote:Originally posted by satya If the size is not big and the count is constant then why not use them inside the database, I don’t see any problem. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.

Ah that brings the memories of Jim Gray http://en.wikipedia.org/wiki/James_N._Gray
Roji. P. Thomas
SQL Server MVP
http://toponewithties.blogspot.com

Usual IMAGE data type in SQL SErver, the other references above should get you what you are looking here.
quote:Originally posted by WingSzeto Thank for the quick response. That’s what I am trying to ask. I like to store them in the database, what data type I can use and is there any speical coding I need to do to display them correctly in a web browser?
quote:Originally posted by satya If the size is not big and the count is constant then why not use them inside the database, I don’t see any problem. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.

Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
Since you’ve posted to the 2005er forum, you should go with VAR…(MAX) data types. —
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
In sql server 2005 for storing word documents use VARBINARY(MAX)… MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

If the word document has both text and photo image(small), will varbinary(max) still work? I haven’t used binary data type before. How do I write code in SQL analyzer to save and display the binary data correctly on the screen?
quote:Originally posted by MohammedU In sql server 2005 for storing word documents use VARBINARY(MAX)… MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

As my prod dbs are still on SQL Server 2000 I have only this link:
http://www.microsoft.com/resources/documentation/sql/2000/all/reskit/en-us/part3/c1161.mspx Anyway, retrieve binary data should be fairly well explained in communities dedicated to your client language. —
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
See BOL topic "Using Large-Value Data Types " Varbinary(Max) is good for storing documents and images…
I don’t think you need to write any special code display the data…it stores as binary data but will be displayed as regular image/document…
and you can create full-text indexes on this…
MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

Just see an example of displaying image in reports from thishttp://blog.toddtaylor.com/CategoryView,category,SQL.aspx blog. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
]]>