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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9: Investigating <strong>FILESTREAM</strong> DatabasesIf the table is partitioned, you will need a different version <strong>of</strong> the above query to retrievethe same information. This is given in Listing 9-13.SELECTt.name AS [Table],f.name AS FilestreamFG,f.physical_name AS FilestreamFolderFROM sys.tables tINNER JOIN sys.partitions pON p.object_id = t.object_idINNER JOIN sys.database_files fON f.data_space_id = p.filestream_filegroup_idAND f.type_desc = '<strong>FILESTREAM</strong>'/*Table FilestreamFG FilestreamFolder----- ------------- ---------------------------------------Items NorthPole_fs1 C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_fs1Items NorthPole_fs2 C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_fs2Items NorthPole_fs3 C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_fs3*/Listing 9-13:Retrieving all the <strong>FILESTREAM</strong> tables and their <strong>FILESTREAM</strong> filegroups on the partitioneddatabase (from Chapter 7).Identifying the <strong>FILESTREAM</strong> folder name associated witheach <strong>FILESTREAM</strong> columnIf a table has more than one <strong>FILESTREAM</strong> column, it will <strong>of</strong>ten be very confusingto identify the folder associated with each column. Listing 9-14 retrieves a list <strong>of</strong> all<strong>FILESTREAM</strong> columns in a table, along with the <strong>FILESTREAM</strong> folder associated withthe column.344

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

Saved successfully!

Ooh no, something went wrong!