Skip to main content

A Way Around "Binary Hell" in SQL Server

by Jörg A.
Consultant,

Warning: this article may offend your religious feelings - sorry about that. All others: play loud!

What is Hell? According to the famous rock band AC/DC (yeah!) it "ain't a bad place to be". For many people, regardless of their confession, it's supposedly some kind of dark pit, nobody knows exactly where it is, but it ought to be used to stow away the bad guys and gals for eternity. Once in a while it might happen that one of its "inhabitants" shows up on the surface, causing nothing but trouble ...

Believe it or not: SQL Server has such a place for the doomed, too. And it's got a name for hell: Binary Large Object, aka BLOB (or LOB for short).

BLOB data-types (in SQL text, image, etc.) are basically used to storing data that does not fit into a "proper" data-type (as int, decimal, varchar, etc.), for example to save Pictures, XML data or Documents and stuff. Technically, there are actually better alternatives for such a storage - or "linkage" to be true -, like using "Record Links" in NAV or the FILESTREAM feature introduced with SQL Server 2008 (unfortunately NAV cannot take advantage of that, yet). But bad habits die hard ... thus still the BLOB is often used ... too often ...

The technical aspects:
Binary data could be stored with up to 2^31 Byte (= 2GB) per field. Usually this data is not saved within the actual row/record as this would tremendously increase the size of the table, respective the "Clustered Index" (I guess we could call that "Hell on Earth" then). Thus, only a 16 Byte pointer is saved in the record, the BLOB ...

FREE Membership Required to View Full Content:

Joining MSDynamicsWorld.com gives you free, unlimited access to news, analysis, white papers, case studies, product brochures, and more. You can also receive periodic email newsletters with the latest relevant articles and content updates.
Learn more about us here

About Jörg A.

Jörg A. Stryk has worked with Microsoft Dynamics NAV since 1997, version 1.20.

Being project-manager, consultant, administrator, developer or supporter on Microsoft partner-sites and NAV customer-sites, he has thoroughly explored nearly all areas of the application and its technology.

Since 2003 he is focusing on "Dynamics NAV & SQL Server Performance Optimization and Troubleshooting", founding his company "STRYK System Improvement" in 2006. As a freelance consultant, he is supporting Microsoft Dynamics partners and customers with their NAV/SQL projects worldwide.

His book "The NAV/SQL Performance Field Guide" (ISBN 978-3-8370-1442-6) is published in Europe, the United Kingdom and North America.

In recognition of his valuable participation in various NAV communities, he received the Microsoft award "Most Valuable Professional" (MVP) for MS Dynamics NAV in 2007, 2008 and 2009.

Visit Jörg Stryk at www.stryk.info or his BLOG http://dynamicsuser.net/blogs/stryk/

More about Jörg A.