SQL Server Unique Constraint

In SQL Server you can create a UNIQUE constraint on a field that is not the primary key.  The “CLUSTERED” keyword must be removed if you already have a clustered index on the table.  Here are some examples of a 1 column and 2 column unique constraint:


ALTER TABLE [dbo].[item_orders2] ADD CONSTRAINT
UNIQUE_Table2 UNIQUE CLUSTERED
(
order_id
) ON [PRIMARY]


ALTER TABLE [dbo].[item_orders3] ADD CONSTRAINT
UNIQUE_Table3 UNIQUE CLUSTERED
(
order_id,
item_id
) ON [PRIMARY]

 

Advertisements

TF26177: The field System.RelatedLinkCount cannot be renamed

I have been trying to work with the TeamReview tool for code reviews.

Problem was, when I tried to install the Work Item templates associated with the code review items, I would get the error:

TF212018: Work item tracking schema validation error: TF26177: The field System.RelatedLinkCount cannot be renamed from 'RelatedLinkCount' to 'Related Link Count'.

So what’s a guy to do?  Turn to google of course.

After some research it becomes clear that between TFS 2008 and 2010 RelatedLinkCount was renamed “Related Link Count” and this was causing the problems.  It’s likely a result of having upgraded our TFS installation from 08 to 2010 instead of doing a fresh install.

After some work I found that I could resolve the problem by renaming the offending bit of XML in the file I was trying to import.  After changing Related Link Count to RelatedLinkCount and running the import again it gave me a few other items (1 after another) that I needed to correct:

IterationId

ExternalLinkCount

HyperLinkCount

AttachedFileCount

AreaId

After fixing all of these the import was successful and everything seems to be working fine.

Here is the XML file with my changes that successfully imported:

UPDATE: I somehow had uploaded the wrong file.  I believe this is actually the one I used successfully: CodeItemenCDMFixed.xml (19.02 KB)

UPDATE 2: Ok I’m stupid.  The confusion worked like this: I downloaded the 2010 version and tried to install on a 2010 server that had been upgraded from 2008.  Had problems.  Made a file to fix it.  Then later tried to install a fresh download from codeplex to a new TFS server, ran into similar problems, but really they were the reverse of what I experienced before (needed remove spaces from words vs needing to add spaces).  Turns out I had downloaded the 2008 version that time.  Totally stupid.

So, if you are trying to install to 2010 and you are getting problems like above, I think using this file will fix your issues:

Code Item en CDM.xml

if not, maybe try this one:

CodeItemenCDMFixed.xml (19.02 KB)

Update 9/25/12: Fixed the URLs to the files above.