?
Solved

Disabling FILESTREAM in SQL

Posted on 2013-06-11
5
Medium Priority
?
628 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 23

Accepted Solution

by:
nemws1 earned 2000 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

765 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