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>Once the <strong>FILESTREAM</strong> filegroup has been added to the database, you can add a<strong>FILESTREAM</strong> file (which points to the <strong>FILESTREAM</strong> data container) using the T-<strong>SQL</strong>command in Listing 2-6.ALTER DATABASE NorthPoleADD FILE (NAME = NorthPole_fs,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter2\NorthPole_fs')TO FILEGROUP NorthPole_fs ;GOListing 2-6:Adding a <strong>FILESTREAM</strong> data container to a database.<strong>The</strong> database is now <strong>FILESTREAM</strong> enabled. We can go ahead and start creating tablesthat contain <strong>FILESTREAM</strong> data.Creating a Table with <strong>FILESTREAM</strong> ColumnsOnce we have a <strong>FILESTREAM</strong>-enabled database, we are ready to go ahead and createtables containing <strong>FILESTREAM</strong> columns. A <strong>FILESTREAM</strong> column is a VARBINARY (MAX)column that has the <strong>FILESTREAM</strong> attribute enabled.Using SSMS table designer to create a table with<strong>FILESTREAM</strong> columnsYou will be surprised if you try to create a table with <strong>FILESTREAM</strong> columns using SSMStable designer in <strong>SQL</strong> <strong>Server</strong> 2008 and <strong>SQL</strong> <strong>Server</strong> 2008 R2 – it appears that the SSMSteam missed this feature, as there is no way to do this in the latest version at the time <strong>of</strong>writing (<strong>SQL</strong> <strong>Server</strong> 2012). You can create a table with a VARBINARY (MAX) column, butthere is no way to set the <strong>FILESTREAM</strong> flag on the column.60

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

Saved successfully!

Ooh no, something went wrong!