Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Default FILESTREAM filegroup is not available in d

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-08-01 : 07:58:50
Hello,

I am creating a table on a SQL 2008 database as follows:

create table Slides (
ID uniqueidentifier not null
constraint PK_Slide primary key clustered,
[File] varbinary(max) filestream default(0x),
[Name] nvarchar(100) null,
) -- Slides

I get the error:
Default FILESTREAM filegroup is not available in database "MyDatabase"

How can I solve this problem?

Thanks,
Miguel

beyondrelational
Starting Member

6 Posts

Posted - 2009-08-01 : 10:37:03
is your database FILESTREAM enabled? Before you can create a table with FILESTREAM columns, the database should be FILESTREAM enabled. The database should have a file group with FILESTREAM attribute.

http://blog.beyondrelational.com
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-08-01 : 11:10:31
I added the following:


exec [sp_filestream_configure] @enable_level = 3;
go
add filegroup Posts contains filestream;
go
alter database MyDatabase
add file ( name = N'????',
filename = N'C:\????' ) TO filegroup [Posts];
go


I am not sure if this is the way and I still have some problems.

On my database I have two tables that contains each one a column for a file: Slides and Posts. In both tables the file column is simply named File.

Shouldn't I create two filegroups: Slides and Posts.
One for Slides files and another for Posts files?
How can I do that?
I don't understand very well the Add File setup.

And can't I define the path of the FilesGroups as the same where the Database file is located?

I am asking this because it would be easier to move the database from my computer to my hosting server ... I think.

Thanks,
Miguel


Go to Top of Page

beyondrelational
Starting Member

6 Posts

Posted - 2009-08-01 : 12:08:51
What is the issue you have after adding the FILESTREAM filegroup?
I see that your CREATE table statement is missing the ROWGUIDCOL attribute in the ID column. I modified it to "ID uniqueidentifier not null ROWGUIDCOL constraint PK_Slide primary key clustered" and I am able to create the table without any problem.

http://beyondrelational.com/blogs/jacob/
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-08-01 : 14:15:55

Hello,

I am using the following:

add filegroup Files contains filestream;

alter database Badb
add file ( name = N'Files', filename = N'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA' )
to filegroup [Files];

create table Slides (
ID uniqueidentifier not null rowguidcol
constraint PK_Slide primary key clustered,
Active bit not null default 0,
[File] varbinary(max) filestream default(0x),
[Name] nvarchar(100) null,
Url nvarchar(400) null
) -- Slides

And I always get the error:
Incorrect syntax near 'filegroup'.

What am I missing?
I checked my code but I can't find the error.

Thank You,
Miguel
Go to Top of Page

beyondrelational
Starting Member

6 Posts

Posted - 2009-08-01 : 14:43:59
You should have an 'ALTER DATABASE dbname ' Before the 'ADD FILEGROUP' clause.

http://beyondrelational.com/blogs/jacob/
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-08-01 : 15:43:10
Yes I also used that:

alter database Badb
add filegroup Files contains filestream;

alter database Badb
add file ( name = N'Files', filename = N'c:\Program Files\Microsoft
SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA' )
to filegroup [Files];

And I get another error:
FILESTREAM feature is disabled.
Invalid filegroup 'Files' specified.
Default FILESTREAM filegroup is not available in database 'Badb'.
No rows affected.
Go to Top of Page

beyondrelational
Starting Member

6 Posts

Posted - 2009-08-01 : 21:34:28
It looks like FILESTREAM feature is not enabled. This document explains how to do it. http://msdn.microsoft.com/en-us/library/cc645923.aspx

http://beyondrelational.com/blogs/jacob/
Go to Top of Page

eralper
Yak Posting Veteran

66 Posts

Posted - 2011-07-28 : 05:07:06
This error is indicating a database whose database files are not configured correctly for filestream

Please check the following article [url]http://www.kodyaz.com/t-sql/default-filestream-filegroup-is-not-available-in-database.aspx[/url] how you can configure filegroups and database files.

-------------
Eralper
http://www.kodyaz.com
Go to Top of Page
   

- Advertisement -