17.07.2015 Views

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1: Storing and Managing Unstructured DataStoring Unstructured DataAs discussed, most business applications need to store, manage and process unstructureddata <strong>of</strong> various shapes and sizes. Choosing the right storage design for this data will becritical to the performance, manageability, and overall health <strong>of</strong> the application and itsdatabase. <strong>The</strong>re are two basic choices: store the LOB in the database, or store it on the filesystem with a pointer to it from within the database. So, depending upon the nature <strong>of</strong>the data, usage pattern, workload and various other factors related to the specific applicationand business requirements, the designers might decide whether to keep the LOBdata within the database or outside the database.Storing Large Objects in <strong>SQL</strong> <strong>Server</strong>Most relational database management systems provide data types that can store LOBs.One can simply create a table with columns <strong>of</strong> the appropriate data types and use theprogramming model provided to read, write, and update the LOB data.Pre-<strong>SQL</strong> <strong>Server</strong> 2005, unstructured data was stored in LOB data types. CLOB data wasstored in TEXT (and NTEXT for Unicode) data types. BLOB data was stored in the IMAGEdata type. <strong>The</strong>se data types could store up to 2 GB <strong>of</strong> data, which was stored separatelyfrom the relational table data.<strong>The</strong>se old LOB data types, while still available, are deprecated in <strong>SQL</strong> <strong>Server</strong> 2005and later, in favor <strong>of</strong> the large-value data types: VARCHAR(MAX) for text data (andNVARCHAR(MAX) for Unicode character data) and VARBINARY(MAX) for BLOB data.Working with these new data types is much easier than working with their older counterparts.For example, reading from, or writing into, a VARCHAR(MAX) column is mucheasier than with a TEXT column.30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!