1

I have an existing database and I'd like to take advantage of the FileTable feature in SQL Server 2012. Looking online, this is how I update the database:

ALTER DATABASE MyDB 
ADD FILEGROUP MyDBFiles CONTAINS FILESTREAM
(
    NAME = SomeCoolName,
    FILENAME= 'C:\FileTable\Data'
)
GO

However, I get Incorrect syntax near 'NAME' error.

What am I doing wrong?

Laith
  • 6,071
  • 1
  • 33
  • 60
  • 3
    See this QA for details on how to do it http://stackoverflow.com/questions/5507495/sql-server-enabling-filestream-after-a-db-has-been-created – Preet Sangha Sep 18 '13 at 01:18

1 Answers1

4

You're using the wrong syntax, you need to add the filegroup first, marking it as containing filestream data and then add a file to that filestream filegroup, like this:

ALTER DATABASE MyDB 
ADD FILEGROUP MyDBFiles CONTAINS FILESTREAM
GO
ALTER DATABASE MyDB
ADD FILE
(
    NAME = 'SomeCoolName',
    FILENAME= 'C:\FileTable\Data'
)
TO FILEGROUP MyDBFiles
GO
steoleary
  • 8,968
  • 2
  • 33
  • 47
  • Thanks steoleary. This works. Could you also help me with the following question: http://stackoverflow.com/questions/18907827/how-to-enable-permissions-in-sql-server-2012-filetable-folder-share – Laith Sep 20 '13 at 02:09