Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm confused with the requirement for a ROWGUID column on a table with FILESTREAM. How is this column going to be used?

Would it be okay if I used a different primary key (clustered) on the same table while letting that ROWGUID column "just be there" without a clustered index?

Like this:

CREATE TABLE Sample
{
    -- This is going to be clustered
    [Id] int NOT NULL,

    -- What shall I do with it index-wise?
    [RowGuid] uniqueidentifier ROWGUIDCOL NOT NULL UNIQUE
}
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

UPDATE: I found something of potential relevance: http://msdn.microsoft.com/en-us/library/cc949109%28d=printer%29.aspx

They've got a similar example:

CREATE TABLE DocumentStore (
       DocumentID INT IDENTITY PRIMARY KEY,
       Document VARBINARY (MAX) FILESTREAM NULL,
       DocGUID UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL
              UNIQUE DEFAULT NEWID () ON Data_FG1)
ON DocPartScheme (DocumentID)
FILESTREAM_ON DocFSPartScheme;
GO

With a remark:

Notice that to use the DocumentID column as the partitioning column, the underlying nonclustered index that enforces the UNIQUE constraint on the DocGUID must be explicitly placed on a filegroup so that the DocumentID column can be the partitioning column. This means that partition switching is only possible if the UNIQUE constraints are disabled before performing the partition switch, as they are unaligned indexes, and then re-enabled afterwards.

I suppose I'll then leave ROWGUID be as it is, a UNIQUE nonclustered index.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.