O'Reilly logo

Programming Microsoft® SQL Server® 2012 by Leonard Lobel and Andrew Brust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required