You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by "Thomas Dudziak (JIRA)" <ji...@apache.org> on 2006/07/19 07:37:15 UTC

[jira] Resolved: (DDLUTILS-50) FK Constraints Failing on Merge in MS-SQL

     [ http://issues.apache.org/jira/browse/DDLUTILS-50?page=all ]

Thomas Dudziak resolved DDLUTILS-50.
------------------------------------

    Resolution: Fixed

This now works (with the revised database alteration algorithm). Actually, now there won't be any SQL executed (as it should be because the DB did not change):

[ddlToDatabase] INFO: Executed 0 SQL command(s) with 0 error(s)


> FK Constraints Failing on Merge in MS-SQL
> -----------------------------------------
>
>                 Key: DDLUTILS-50
>                 URL: http://issues.apache.org/jira/browse/DDLUTILS-50
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - SqlServer
>         Environment: WinXP Pro, SQL Server 2000, Java 1.4.2
>            Reporter: Colin Ritchie
>         Assigned To: Thomas Dudziak
>             Fix For: 1.0
>
>
> 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