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>First, you have to drop the <strong>FILESTREAM</strong> column from the table (Listing 2-29).-- Drop the <strong>FILESTREAM</strong> columnALTER TABLE Items DROP COLUMN ItemImageListing 2-29:Dropping the <strong>FILESTREAM</strong> column from the Items table.Note that the association between the <strong>FILESTREAM</strong> filegroup and the table remains, evenafter dropping the <strong>FILESTREAM</strong> column; <strong>SQL</strong> <strong>Server</strong> still thinks that the <strong>FILESTREAM</strong>filegroup is not empty. <strong>The</strong> table is still linked to its <strong>FILESTREAM</strong> filegroup even thoughthere are no <strong>FILESTREAM</strong> columns in the table.Next, you must disassociate the table from its <strong>FILESTREAM</strong> filegroup by setting the<strong>FILESTREAM</strong>_ON attribute to NULL. Listing 2-30 shows how to do this.-- Disassociate table "items" from its <strong>FILESTREAM</strong> filegroupALTER TABLE Items SET (<strong>FILESTREAM</strong>_ON = "NULL")Listing 2-30:Disassociating a table from its <strong>FILESTREAM</strong> filegroup.Now you can remove the <strong>FILESTREAM</strong> file and filegroup using ALTER DATABASE. Listing2-31 shows how to remove the <strong>FILESTREAM</strong> capabilities from the example database.-- Remove the FileALTER DATABASE NorthPole REMOVE FILE NorthPoleFS ;-- Remove the FilegroupALTER DATABASE NorthPole REMOVE FILEGROUP NorthPoleFS ;Listing 2-31:Removing <strong>FILESTREAM</strong> features from a database.87

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

Saved successfully!

Ooh no, something went wrong!