[ http://issues.apache.org/jira/browse/DDLUTILS-109?page=all ]
Thomas Dudziak updated DDLUTILS-109: ------------------------------------ Component: Core - SqlServer > 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 > Components: Core - SqlServer > 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 '[EMAIL PROTECTED]' drop constraint '[EMAIL > PROTECTED]) > 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