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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Flexible File Storage

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2011-06-28 : 18:23:43
Hello,

I have two tables: Books and Posts.

Books has two FileStream fields and Posts has one.


create table dbo.Books
(
Id int identity not null
constraint Books_Id_PK primary key clustered (Id),
Abstract varbinary (max) filestream null
constraint Books_Abstract_DF default (0x),
Paper varbinary (max) filestream null
constraint Books_Paper_DF default (0x),
[Key] uniqueidentifier rowguidcol not null
constraint Books_Key_U unique,
Title nvarchar(400) null
) filestream_on [STORAGE]

create table dbo.Posts
(
Id int identity not null
constraint Posts_Id_PK primary key clustered (Id),
Photo varbinary (max) filestream null
constraint Posts_Photo_DF default (0x),
[Key] uniqueidentifier rowguidcol not null
constraint Photos_Key_U unique,
Title nvarchar(400) null
) filestream_on [STORAGE]


Is it possible to have all files in a single table?
Basically I would have three tables:
Files, BooksFiles and PostsFiles.

The problem is how in, for example BookFiles, to specify which file is the Paper and which is the Abstract.

Is there a flexible way to accomplish a way to have a table to hold all filestreams for all other tables?

Thank You,
Miguel
   

- Advertisement -