Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Should I use Text field or Binary field ?

Author  Topic 

Jon G
Starting Member

31 Posts

Posted - 2008-06-01 : 10:26:21
Application is ocr'ing tiff image files and then storing the resultant text data in a text field in SQL 2005 database. This field is then used with the full text catalog.

All works fine,

However, am I using the correct field type to store the text files for efficiency and space saving?

If I use a binary field, does this reduce the size of the database by compressing the text data in the binary field? Also, is there a limit as to the size of text file that I could store in a binary field?

It would be good to get feedback on this before I go too far down the wrong road.

So, text field to store the text data or binary field to store the actual text file?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 04:12:25
VARCHAR(MAX)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Jon G
Starting Member

31 Posts

Posted - 2008-06-02 : 05:19:34
Thanks for you reply.

what is the difference between varchar(max) and a text field? Why is varchar(max) more efficient than a text field?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 05:24:05
It's not.
But you can use standard functions to manipulate the content.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Jon G
Starting Member

31 Posts

Posted - 2008-06-02 : 05:28:38
If I were to store the actual text file in a binary field instead, would that be more efficient in terms of minimizing the storage space required?

thanks again
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 05:33:49
No, it doesn't matter if you use IMAGE or BINARY.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Jon G
Starting Member

31 Posts

Posted - 2008-06-02 : 05:56:34
so, just to recap. In terms of storage space, it doesn't matter if I use a text field, a varchar(max) field, and image field or a binary field, they will all take up the same amount of space...none of them compress the data?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 06:57:06
Not until SQL Server 2008.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Jon G
Starting Member

31 Posts

Posted - 2008-06-02 : 07:41:21
That's interesting. So SQL server 2008 has the ability to compress data ?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 08:09:11
Yes.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Jon G
Starting Member

31 Posts

Posted - 2008-06-02 : 08:31:19
Does that apply to all field types or just certain types? In other words, should I choose a particular field type now to be ready for 2008?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 09:04:24
http://blogs.msdn.com/sqlserverstorageengine/archive/2007/11/12/types-of-data-compression-in-sql-server-2008.aspx



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Jon G
Starting Member

31 Posts

Posted - 2008-06-02 : 09:11:31
many thanks
Go to Top of Page
   

- Advertisement -