﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Database Deployment Toolkit » Database Deployment Toolkit (How do I?)  » Unique Index Problem</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 10:12:58 GMT</lastBuildDate><ttl>20</ttl><item><title>Unique Index Problem</title><link>http://forum.strataframe.net/FindPost19056.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;I have a ROWGUID field and index in every table in a SQL Server 2005 database. The indexes&amp;nbsp;are unique and non-clustered and all indexes and fields are called the same - ROWGUID. This database is pre-StrataFrame so I am trying to setup the model in DDT to match it.&lt;/P&gt;&lt;P&gt;After&amp;nbsp;I set the Unique property on the ROWGUID indexes (see attached screenshot), when I try and deploy a new database, it will only create the index on the first table and for all other tables the DDT reports the error:-&lt;/P&gt;&lt;P&gt;"There is already an object named 'ROWGUID' in the database. Could not create constraint."&lt;/P&gt;&lt;P&gt;When the Unique property is set, it looks like the DDT wants the indexes to be called different names. When the Unique property is reset it will create the indexes albeit as non-unique.&lt;/P&gt;&lt;P&gt;SQL Server doesn't need a Unique index to have a unique name so I was wondering&amp;nbsp;if I have missed something?&lt;/P&gt;&lt;P&gt;Aaron</description><pubDate>Wed, 08 Apr 2009 13:25:34 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost22682.aspx</link><description>Got it. :)</description><pubDate>Wed, 08 Apr 2009 13:25:34 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost22678.aspx</link><description>I will send you a SQL script shortly that will create a full database to show the problem.&lt;br&gt;
&lt;br&gt;
Thanks</description><pubDate>Wed, 08 Apr 2009 10:25:27 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost22676.aspx</link><description>I guess I need more information then because I cannot get SQL Server to allow this.&amp;nbsp; The DDT actually let's you create the index names.&amp;nbsp; But SMO is preventing them from being distributed this way.&amp;nbsp; I will need a sample package and more details to work this this issue.&amp;nbsp; I am more than willing to add anything that falls within the support of SQL Server 2005 or greater if supported by these versions.&amp;nbsp; But at the moment, I am not understanding what you are trying to do apparently.</description><pubDate>Wed, 08 Apr 2009 09:14:06 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost22663.aspx</link><description>Hi Guys,&lt;br&gt;
&lt;br&gt;
Just thought I would bump this one as it came back to haunt me today. Just to summarise the above I have a unique index called ROWGUID in each table and when I try and make this a unique index in the DDT, it always creates the indexes as non-unique. I only want to create them as indexes and not constraints.&lt;br&gt;
&lt;br&gt;
I know there was some discussion above on whether a unique index should also have a unique name, but to quote Microsoft:-&lt;br&gt;
&lt;br&gt;
"Index names must be unique within a table, but do not have to be unique within a database."&lt;br&gt;
&lt;br&gt;
I am not sure this is actually the problem - it could be nothing more than the Unique index flag is not working. To date, I have had to run another database schema tool after the DDT package has run to correct the problem and today I forgot :( Hence the bump.&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Aaron</description><pubDate>Mon, 06 Apr 2009 16:47:49 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost19239.aspx</link><description>Hi Dustin,&lt;/P&gt;&lt;P&gt;As SQL Server allows it then it would be great if the DDT allowed it too. I have come up with a workaround in the meantime by using a database schema comparison tool so it isn't a big problem.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Aaron</description><pubDate>Tue, 09 Sep 2008 18:03:25 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost19196.aspx</link><description>We'll have to discuss this before I can give an answer either way on this one. We generally consider non-unique index names to be bad practice (there are situations where it can get you into trouble), hence the prevention within the DDT.&lt;/P&gt;&lt;P&gt;Regardless, we'll discuss it and we may allow you to do this in the future, but it's not likely to change for 1.6.6.</description><pubDate>Tue, 09 Sep 2008 09:43:24 GMT</pubDate><dc:creator>Dustin Taylor</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost19091.aspx</link><description>I think the DDT is trying to create it as a unique constraint rather than a unique index - at least that is what the error message and behaviour suggest.</description><pubDate>Thu, 04 Sep 2008 18:39:08 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost19088.aspx</link><description>I stand corrected. It looks like an index has to be unique by table, but not for the entire DB.  Interestingly, I tested this and it works if I write the SQL directly, but doesn't like it when using SSMS.  For this reason, I've always just created unique index names.  So, I think this is one that the SF team is going to have to answer.  Sorry  :ermm:</description><pubDate>Thu, 04 Sep 2008 18:05:49 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost19080.aspx</link><description>Hi Greg,&lt;/P&gt;&lt;P&gt;The production database I am trying to duplicate in DDT has been in use for years and is currently installed with many customers in SQL Server 2005. SQL Server 2005 doesn't require a unique name for a unique index in our model as the two attached screenshots hopefully demonstrate.&lt;/P&gt;&lt;P&gt;Basically, I am trying to build an application on top of our existing production database and I only noticed the problem when a database schema tool reported that the DDT generated indexes were not set as unique. I changed this and immediately hit the problem.&lt;/P&gt;&lt;P&gt;I appreciate that I could change the name of every field but our customers have this database currently installed in around&amp;nbsp;several&amp;nbsp;thousand SQL&amp;nbsp;2005&amp;nbsp;instances and to upgrade them would be painful when all I really want to do is to have the DDT generate the same database that we are already using.&lt;/P&gt;&lt;P&gt;Aaron</description><pubDate>Thu, 04 Sep 2008 15:20:03 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: Unique Index Problem</title><link>http://forum.strataframe.net/FindPost19075.aspx</link><description>Aaron,&lt;br&gt;
&lt;br&gt;
Actually, SQL Server does require that each index have a unique name within a db.schema.  When you use SQL Server Management Studio, it creates a unique name for each index automatically. I'd suggest that you prefix the ROWGUID with the table name:&lt;br&gt;
&lt;br&gt;
Table1_ROWGUID&lt;br&gt;
Table2_ROWGUID&lt;br&gt;
&lt;br&gt;
Hope that helps.</description><pubDate>Thu, 04 Sep 2008 13:57:54 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>