FK Constraints Failing on Merge in MS-SQL
-----------------------------------------

         Key: DDLUTILS-50
         URL: http://issues.apache.org/jira/browse/DDLUTILS-50
     Project: DdlUtils
        Type: Bug
 Environment: WinXP Pro, SQL Server 2000, Java 1.4.2
    Reporter: Colin Ritchie
 Assigned to: Thomas Dudziak 


Re-running the writeSchemaToDatabase task on an existing MS-SQL database causes 
errors on all the foreign-key nodes, reporting the error "There is already an 
object named 'name' in the database".

Snippet of my schema:

<table name="oci_schedules">
  <column name="schd_m_id" primaryKey="false" required="true" type="INTEGER" 
default="0" autoIncrement="false"/>
  <foreign-key foreignTable="oci_schedule_modes">
    <reference local="schd_m_id" foreign="schd_m_id"/>
  </foreign-key>
</table>

<table name="oci_schedule_modes">
  <column name="schd_m_id" primaryKey="true" required="true" type="INTEGER" 
autoIncrement="true" description="auto_increment"/>
</table>

Error:
[ddlToDatabase] SQL Command ALTER TABLE "oci_schedules"
[ddlToDatabase]     ADD CONSTRAINT 
"oci_schedules_FK_schd_m_id_oci_schedule_modes" FOREIGN KEY ("schd_m_id") 
REFERENCES"oci_schedule_modes" ("schd_m_id") failed with [Microsoft][SQLServer 
2000 Driver for JDBC][SQLServer]There is already an object named 
'oci_schedules_FK_schd_m_id_oci_schedule_modes' in the database.

I have tried this using the open source JTDS 1.1, with the same error message.  
I have also tried specifying the foreign key name in the XML node, with the 
same result.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to