Direct Streaming in .NET with SqlFileStream

You just saw how to embed and extract binary streams of data in T-SQL. A similar T-SQL approach can be used with ADO.NET in your .NET applications to embed and extract byte arrays against varbinary(max) FILESTREAM columns. It’s easy, and it works, but it is not the most efficient way to transfer BLOBs into and out of the database. Behind the scenes, SQL Server must use its own memory to stream BLOBs in and out, and it exposes BLOBs to client applications as varbinary(max) data types that are not optimized for streaming.

The proper (and fastest) way to get data into and out of FILESTREAM columns is to build a .NET client application (written in C# or VB .NET, for example), and use the special SqlFileStream ...

Get Programming Microsoft® SQL Server® 2012 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.