Sql-server – sql 2008 filestream how to check if exists

sql serversql-server-2008

We are going to start using the sql 2008 filestream and going through the instruction setting it up. One of the items that we do is have everything in a single sql script that can be run multiple times without corrupting the data or executing unnecessary steps.

So far have created the file stream group and now want to define the filestream data container with the following statement

ALTER DATABASE Production ADD FILE (
       NAME = FSGroup1File,
       FILENAME = 'F:\Production\FSDATA')
TO FILEGROUP FileStreamGroup1;
GO

Is there any way that I can check to see if this has already been done?
i.e.

if (select COUNT(*) from sys.????? where name = '?????')=0
ALTER DATABASE Production ADD FILE (
       NAME = FSGroup1File,
       FILENAME = 'F:\Production\FSDATA')
TO FILEGROUP FileStreamGroup1;
GO

Sorry if this is a basic question but am bit of a novice when it comes to DB.

Thanks.

Best Answer

IF NOT EXISTS (select 1 from sys.database_files where name = 'LogicalFileName')
     ALTER DATABASE...

Edit: Corrected view name to match suggestion by Nick Kavadias.