db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoffer Hammarström (JIRA) <j...@apache.org>
Subject [jira] Updated: (DDLUTILS-109) MSSqlBuilder can't drop a table with constraints with names longer than 60 characters
Date Mon, 29 May 2006 07:41:30 GMT
     [ http://issues.apache.org/jira/browse/DDLUTILS-109?page=all ]

Christoffer Hammarström updated DDLUTILS-109:
---------------------------------------------

    Attachment: DDLUTILS-109.patch

This patch fixes the problem.

> MSSqlBuilder can't drop a table with constraints with names longer than 60 characters
> -------------------------------------------------------------------------------------
>
>          Key: DDLUTILS-109
>          URL: http://issues.apache.org/jira/browse/DDLUTILS-109
>      Project: DdlUtils
>         Type: Bug

>     Reporter: Christoffer Hammarström
>     Assignee: Thomas Dudziak
>  Attachments: DDLUTILS-109.patch
>
> I get this error because the constraint name has been truncated to 60 characters (These
are the same foreign keys i had trouble with in DDLUTILS-106, but on existing databases):
> 'new_doc_permission_sets_ex_FK_meta_id_set_id_new_doc_permiss' is not a constraint. Query:
IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'Tmp_new_doc_permission_sets')
> BEGIN
>      DECLARE @reftable nvarchar(60), @constraintname nvarchar(60)
>      DECLARE refcursor CURSOR FOR
>      select reftables.name tablename, cons.name constraintname
>       from sysobjects tables,
>            sysobjects reftables,
>            sysobjects cons,
>            sysreferences ref
>        where tables.id = ref.rkeyid
>          and cons.id = ref.constid
>          and reftables.id = ref.fkeyid
>          and tables.name = 'Tmp_new_doc_permission_sets'     OPEN refcursor
>      FETCH NEXT from refcursor into @reftable, @constraintname
>      while @@FETCH_STATUS = 0
>      BEGIN
>        exec ('alter table '+@reftable+' drop constraint '+@constraintname)
>        FETCH NEXT from refcursor into @reftable, @constraintname
>      END
>      CLOSE refcursor
>      DEALLOCATE refcursor
>      DROP TABLE Tmp_new_doc_permission_sets
> END;

-- 
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


Mime
View raw message