Solved

Disabling FILESTREAM in SQL

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
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.

708 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

18 Experts available now in Live!

Get 1:1 Help Now