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 2: Getting Started with<strong>FILESTREAM</strong>As we discussed in the previous chapter, <strong>FILESTREAM</strong> enables you to store BLOB data inthe file system so that you can take advantage <strong>of</strong> the streaming and caching capabilities<strong>of</strong> NTFS. By accessing the BLOB data using the Win32 streaming APIs exposed by <strong>SQL</strong><strong>Server</strong> 2008, you can <strong>of</strong>fload the processing overhead from <strong>SQL</strong> <strong>Server</strong>.In this chapter, we look in detail at how <strong>FILESTREAM</strong> data is stored, and how you set upa <strong>FILESTREAM</strong> database, table, and column. We then provide an example <strong>of</strong> insertingdata into the column.<strong>The</strong> <strong>FILESTREAM</strong> Data Container<strong>SQL</strong> <strong>Server</strong> stores the <strong>FILESTREAM</strong> data in a file system folder which is known as the<strong>FILESTREAM</strong> data container. Each <strong>FILESTREAM</strong>-enabled database must have its ownunique data container. <strong>The</strong> location <strong>of</strong> the <strong>FILESTREAM</strong> data container is specified whenyou create a <strong>FILESTREAM</strong>-enabled database or when you enable <strong>FILESTREAM</strong> on anexisting database.<strong>SQL</strong> <strong>Server</strong> creates a number <strong>of</strong> subfolders in the data container to manage the<strong>FILESTREAM</strong> data; a folder is created for each table, with one or more <strong>FILESTREAM</strong>columns. If a table is partitioned, a folder is created for each partition. Within the folderfor each table or partition, a subfolder is created for each <strong>of</strong> the <strong>FILESTREAM</strong>-enabledcolumns, to store the BLOB data.48

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

Saved successfully!

Ooh no, something went wrong!