Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server - Enabling FileStream after a DB has been created

Tags:

sql-server

We have a database and have decided to enable it for FileStream use. I think I've done everything I'm supposed to except creating a FileStream Data Container. I can't seem to find a way to do this in SSMS 2008 on our existing database. Can this only be done at the time a database is created?

like image 523
Randy Minder Avatar asked Mar 31 '11 23:03

Randy Minder


People also ask

How do I enable Filestream on an existing database?

Enabling FILESTREAMRight-click the instance, and then click Properties. In the SQL Server Properties dialog box, click the FILESTREAM tab. Select the Enable FILESTREAM for Transact-SQL access check box. If you want to read and write FILESTREAM data from Windows, click Enable FILESTREAM for file I/O streaming access.

How do I add Filestream attribute to an existing column?

1 Answer. Show activity on this post. If you encounter an error message "A table that has FILESTREAM columns must have a nonnull unique column with the ROWGUIDCOL property." you can add this property to a column with the following T-SQL statement: ALTER TABLE <TableName> ALTER COLUMN <IdColumnName> ADD ROWGUIDCOL .

How do I use SQL Filestream?

To use FILESTREAM, you must create or modify a database to contain a special type of filegroup. Then, create or modify a table so that it contains a varbinary(max) column with the FILESTREAM attribute. After you complete these tasks, you can use Transact-SQL and Win32 to manage the FILESTREAM data.

How do I create a Filestream filegroup in SQL Server?

Click on 'Add FileGroup' in the FILESTREAM section and specify the name of the SQL Server FILESTREAM filegroup. Click 'OK' to create the database with this new filegroup. Once the database is created, open the database properties to add the file in the newly created 'DemoFileStream' filegroup.


1 Answers

To add FS support to existing database just create a new filegroup, then add the fs file;

alter database YourDatabase add filegroup fsGroup contains filestream; go  alter database YourDatabase add file   ( NAME = 'fsYourDatabase', FILENAME = 'c:\<your_file_path>'    ) to filegroup fsGroup; go 

More here: BOL Link

And definitely read everything Paul Randal has written about filestream: link

like image 109
nathan_jr Avatar answered Sep 18 '22 15:09

nathan_jr