Solved

Disabling FILESTREAM in SQL

Posted on 2013-06-11
5
487 Views
Last Modified: 2013-06-12
We have a project that we are allowing the FILESTREAM feature in SQL 2008/12 to be used by some users (there are certain files that are being stored in the DB). The problem that I see us running into is if a user who moves to the FILESTREAM for storing their records decides they want to move back to storing them in the DB.

Is there a way of "reversing" the process and go from FILESTREAM to "normal" storage with a BLOB?
0
Comment
Question by:aceswildab1
5 Comments
 
LVL 23

Accepted Solution

by:
nemws1 earned 500 total points
ID: 39239365
Whether the data is stored in the FILESTREAM space is determined by the table.  These are both valid tables, the first stores in the FILESTREAM, the second does not:
CREATE TABLE my_data1 (
	[id] [UNIQUEIDENTIFIER] NOT NULL UNIQUE ROWGUIDCOL
	, [mydata] VARBINARY(MAX) FILESTREAM
	);

CREATE TABLE my_data2 (
	[id] [UNIQUEIDENTIFIER] NOT NULL UNIQUE ROWGUIDCOL
	, [mydata] VARBINARY(MAX)
	);

Open in new window


If you were to create both of these tables, data in my_data1 would be in the filestream, data in my_data2 would not.  You just move rows from one table to the other to have them into the filestream or not.

If you want one table to do this, I guess you could just have 2 fields in your table, one that is in the filestream and one that is not.  This is bad database design, though.

CREATE TABLE my_data3 (
	[id] [UNIQUEIDENTIFIER] NOT NULL UNIQUE ROWGUIDCOL
	, [mydatafs] VARBINARY(MAX) FILESTREAM
        , [mydata_nonfs] VARBINARY(MAX)
	);

Open in new window

0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 39239580
The problem that I see us running into is if a user who moves to the FILESTREAM for storing their records decides they want to move back to storing them in the DB.

Why would users decide of their storage scheme since they are mainly interested in having their binaries available.  They can live with the idea of not use BLOB but they will be mad if their files are not available to them.

BLOB is just a poor way of storing binaries both due to locking and lack of scalability (degradation of performance is awful as the number of files grow larger).  I really need to  discourage you to move back to BLOB due to the huge amount of problems they cause: it would be a mistake.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 39239968
BLOB is just a poor way of storing binaries both due to locking and lack of scalability (degradation of performance is awful as the number of files grow larger).
Not to mention backups become a nightmare.
0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 39240473
Not to mention backups become a nightmare.
Yep.  I have so many issues with BLOB that I wander why MS has not deprecated that feature yet.  FILESTREAM works so much better.
0
 

Author Closing Comment

by:aceswildab1
ID: 39240786
That makes sense. Making a table with the extra column then removing the column that i don't need after the fact would fix the problem. It would temporarily be bad DB design, but I could remedy that.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now