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>Note that, after deleting the <strong>FILESTREAM</strong> column, the table will still be associated withthe <strong>FILESTREAM</strong> filegroup. Even if you delete all the <strong>FILESTREAM</strong> columns and tryto drop the <strong>FILESTREAM</strong> file or filegroup, you will get an error stating that the file orfilegroup is not empty. After dropping all the <strong>FILESTREAM</strong> columns, you have to set<strong>FILESTREAM</strong>_ON to NULL, using ALTER TABLE … SET (<strong>FILESTREAM</strong>_ON = "NULL").If you have created <strong>FILESTREAM</strong> columns on a table and later on decide to move backto VARBINARY(MAX), you might also want to drop the GUID column you created onthe table. This is relevant in cases where the GUID column was added only to fulfill the<strong>FILESTREAM</strong> requirement.Tables and <strong>FILESTREAM</strong> filegroupsEach table that contains <strong>FILESTREAM</strong> columns must be associated with at least one<strong>FILESTREAM</strong> filegroup. A table can be associated with more than one <strong>FILESTREAM</strong>filegroup if it is partitioned.As discussed earlier, depending upon your design requirements, all tables can beassociated with a single <strong>FILESTREAM</strong> filegroup, or they can each be associated witha separate filegroup (or some combination). This decision may be made based on the<strong>FILESTREAM</strong> load that you expect to have in each table; using separate filegroups candistribute the <strong>FILESTREAM</strong> I/O load if they are located on different devices.You can specify the <strong>FILESTREAM</strong> filegroup in which you would like to store the<strong>FILESTREAM</strong> data when you create a table. If you do not specify the <strong>FILESTREAM</strong>filegroup, <strong>SQL</strong> <strong>Server</strong> will associate the default <strong>FILESTREAM</strong> filegroup with that tableand all the <strong>FILESTREAM</strong> data for that table will be stored there. When a table isassociated with a <strong>FILESTREAM</strong> filegroup, all the <strong>FILESTREAM</strong> data from all<strong>FILESTREAM</strong> columns that exist in that table will go to the same filegroup. It is notpossible to configure two <strong>FILESTREAM</strong> columns in the same table to store their data intwo separate <strong>FILESTREAM</strong> filegroups.68

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

Saved successfully!

Ooh no, something went wrong!