Solved

Filestream index randomly changing filegroup

Posted on 2014-01-23
3
386 Views
Last Modified: 2014-01-24
I have a table with a filestream column holding about 2000 photographs. When I created it I set the primary key to the unique identifier column (probably an unnecessary step). I checked table properties and it was assigned to the filestream filegroup. Everything OK for a couple of weeks, repopulating the table many times without incident. Just now I have discovered that the index has moved itself from the filestream filegroup to the default secondary (user data) filegroup. After repopulating the table I got the message:

Could not allocate space for object 'dbo.T_AllPhotos' in database 'myDB' because the 'FG_UserData' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

By way of confirmation I checked the table's filegroup in table properties and queried sys.filegroups/sys.indexes, and it has indeed moved. I've now dropped the primary key on this table (there are no other indexes), but am still stuck with this table being in the wrong filegroup. The only thing that changed recently was that I added a new varchar column to the table, not indexed. Can this really be responsible for filegroup changing?
0
Comment
Question by:TimHudspith
  • 2
3 Comments
 
LVL 18

Expert Comment

by:x-men
ID: 39803141
create a clustered index on the filestream filegroup.
0
 

Author Comment

by:TimHudspith
ID: 39805601
Can you guide me on the synatax? The following gives me the error 'invalid filegroup specified'.

CREATE UNIQUE CLUSTERED INDEX ux_AllPhotos_Filename
ON dbo.T_AllPhotos(Filename)
ON [FG_Filestream]

Open in new window

0
 
LVL 18

Accepted Solution

by:
x-men earned 500 total points
ID: 39805985
for table :
                                           
CREATE TABLE dbo.T_AllPhotos
      (
      EmployeeId int
      ,[filename] varbinary(max) FILESTREAM NULL
      ,MyRowGuidColumn uniqueidentifier NOT NULL ROWGUIDCOL
          UNIQUE DEFAULT NEWID()
      );



CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex-20140124-094404] ON [dbo].[T_AllPhotos]
(
      [EmployeeId] ASC
) FILESTREAM_ON [FG_Filestream]
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

756 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