Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disabling FILESTREAM in SQL

Posted on 2013-06-11
5
Medium Priority
?
665 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

636 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