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 3: Accessing <strong>FILESTREAM</strong> Data from Client Applicationsclosed and transaction is committed. <strong>The</strong> old <strong>FILESTREAM</strong> data file will be removed byan asynchronous garbage collector thread.Note that any UPDATE triggers that exist on the target table will be fired when the<strong>FILESTREAM</strong> file handle is closed.Partial updates to <strong>FILESTREAM</strong> dataA partial update involves replacing a part <strong>of</strong> an existing <strong>FILESTREAM</strong> data file with newcontent, or appending to the end <strong>of</strong> an existing BLOB file. Unlike partial updates onVARBINARY(MAX) columns, attempting partial updates on <strong>FILESTREAM</strong> cells is a veryslow operation because a new disk file will be created with the new file content every timethe contents change. This adds a lot <strong>of</strong> additional I/O requirements. In effect, there isno such thing as a partial update to a <strong>FILESTREAM</strong> data file so, if your business or applicationrequires frequent small partial updates to the BLOB data, you might want to useVARBINARY(MAX) columns rather than <strong>FILESTREAM</strong> storage.If necessary to support a legacy application, partial updates can be simulated by openingthe <strong>FILESTREAM</strong> data file for read-write access and then moving the file pointer tothe appropriate position before writing the new data to the desired location, eitheroverwriting existing data, or appending the data to the end <strong>of</strong> the file.Any UPDATE triggers that exist on the target table will be fired when the <strong>FILESTREAM</strong>file handle is closed.104

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

Saved successfully!

Ooh no, something went wrong!