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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.