Solved

Disabling FILESTREAM in SQL

Posted on 2013-06-11
5
543 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

733 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