Solved

SQL2005's varbinary(MAX)

Posted on 2007-04-09
1
1,517 Views
Last Modified: 2012-06-21
Can SQL2005's varbinary(MAX) actually store large DOC, PDF, XLS, JPG files in full? I mean these files are physically stored in a table column instead of under a folder in the file system? Thanks.
0
Comment
Question by:ksfok
1 Comment
 
LVL 11

Accepted Solution

by:
dready earned 500 total points
ID: 18879475
When used for tables, it's important to realize that the MAX types have a slightly different row overflow behavior than the TEXT and IMAGE types. In SQL Server, the maximum row size is 8060 bytes. To get around this restriction and still manage storage of up to 2 GB per instance, data stored using the TEXT and IMAGE types is automatically placed off-row by the storage engine, leaving only a 16-byte pointer in the row. That means row sizes are decreased, which is good for performance. Retrieving the large data is expensive, however, since it is not stored in the same place as the on-row data.

The MAX data types, by default, use a hybrid of the TEXT/IMAGE overflow behavior and the behavior of the normal (sized) VARCHAR/VARBINARY types. If a column's data, plus the data in all of the other columns in the table, has a total size of less than 8060 bytes, the data is stored in-row. If the data exceeds 8060 bytes, the data in the MAX column will be stored off-row.

You can change the default behavior of the MAX data types on a per-table basis and they'll behave just like the TEXT and IMAGE types. This is accomplished using the "large value types out of row" option of the sp_tableoption stored procedure.  Use the following T-SQL:

EXEC sp_tableoption
    'myTable',
    'large value types out of row',
    '1'

0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
2 comma seperated list - SQL Server 12 45
SQL Agent Timeout 5 69
SQL Restore Script - Syntax Error 8 106
Restrict result set 1 43
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question