Skip to main content Microsoft Intelligent Data Platform Azure Arc Azure databases Power BI SQL Server 2025 SQL Server BI SQL Server 2022 SQL Server 2019 SQL Server 2017 SQL Server 2016 SQL Server 2005 - 2014 Downloads Community SQL End of Support Data Security - SQL Server Encryption SQL Server blog SQL Server and Azure SQL workshops Browse Microsoft Solutions Hub SQL Server Tech Community Azure Databases Tech Community Azure Synapse Analytics Tech Community Developer Find a partner Become a partner Partner resources Try SQL Server 2025 Microsoft Security Azure Dynamics 365 Microsoft 365 Microsoft Teams Windows 365 Microsoft AI Azure Space Mixed reality Microsoft HoloLens Microsoft Viva Quantum computing Sustainability Education Automotive Financial services Government Healthcare Manufacturing Retail Find a partner Become a partner Partner Network Microsoft Marketplace Software companies Blog Microsoft Advertising Developer Center Documentation Events Licensing Microsoft Learn Microsoft Research View Sitemap
·
2 min read

Files, BLOBs, NTFS and SQL Server 2008 – Age old database dilemma solved!

One of the most exciting new features in SQL Server 2008 is the ability to store files and BLOBs directly in the file system, while maintaining transactional consistency with a SQL Server 2008 database. SQL Server 2008’s new FILESTREAM attribute for VARBINARY data type solves the age old dilemma facing developers and IT Pros: Is it better to store files directly in a database or store them in the file system with path and filenames stored back in tables to maintain the relationship with the database.

Both approaches have pros and cons: Storing files directly in a database secures information using database permissions and enables this data to participate in transactions and backups. This approach, however, does not provide the best performance and storing large files can add significant size to a database. On the other hand, storing files in the file system while using tables and columns to link them to a database is less taxing on a database and provides more flexibility and performance since NTFS is very efficient at managing files. This approach, however, leaves files vulnerable to corruption or deletion, plus files cannot participate in transactions and backups which can leave a database unstable. Another issue in storing files outside the database is that the logic for linking these files to the database must be maintained (and duplicated) in any application that uses this data. This introduces maintenance issues that can become burdensome and complex as the number of applications connecting to the database increases and as the number of people or teams involved in managing this data increases.

SQL Server 2008 solves this dilemma elegantly. VARBINARY’s new FILESTREAM attribute provides the best of both worlds. By simply specifying FILESTREAM for VARBINARY data types, SQL Server 2008 shackles data (i.e. files or BLOBs) for that column to the table, while leveraging Windows NTFS to actually store and retrieve the data outside the database. This shackled data resides in the file system yet is managed entirely by SQL Server 2008. This data is protected by the database permissions and participates fully in transactions and backups as expected. Outside the database, users see this data as regular files in the file system that cannot be modified or deleted without admin rights since they are owned by SQL Server.

Here are a few interesting links discussing FILESTREAM:

Paper: Managing Unstructured Data with SQL Server 2008 (Whitepaper)

FileStream Data Type: SQL Server 2008

SQL Server 2008 – FILESTREAM, WPF and HTTP 

English (United States)
Your Privacy Choices Opt-Out Icon Your Privacy Choices
Consumer Health Privacy Sitemap Contact Microsoft Privacy Manage cookies Terms of use Trademarks Safety & eco Recycling About our ads