Return-Path: Delivered-To: apmail-db-ddlutils-dev-archive@www.apache.org Received: (qmail 57227 invoked from network); 1 Dec 2006 04:26:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Dec 2006 04:26:43 -0000 Received: (qmail 50675 invoked by uid 500); 1 Dec 2006 04:26:52 -0000 Delivered-To: apmail-db-ddlutils-dev-archive@db.apache.org Received: (qmail 50655 invoked by uid 500); 1 Dec 2006 04:26:52 -0000 Mailing-List: contact ddlutils-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ddlutils-dev@db.apache.org Delivered-To: mailing list ddlutils-dev@db.apache.org Received: (qmail 50644 invoked by uid 99); 1 Dec 2006 04:26:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Nov 2006 20:26:52 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Nov 2006 20:26:43 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id F401E7142F7 for ; Thu, 30 Nov 2006 20:26:22 -0800 (PST) Message-ID: <10766574.1164947182996.JavaMail.jira@brutus> Date: Thu, 30 Nov 2006 20:26:22 -0800 (PST) From: "Thomas Dudziak (JIRA)" To: ddlutils-dev@db.apache.org Subject: [jira] Updated: (DDLUTILS-127) MsSqlBuilder does not drop foreign keys to a table before dropping the table. In-Reply-To: <29853541.1156941022483.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/DDLUTILS-127?page=3Dall ] Thomas Dudziak updated DDLUTILS-127: ------------------------------------ Fix Version/s: 1.0 > MsSqlBuilder does not drop foreign keys to a table before dropping the ta= ble. > -------------------------------------------------------------------------= ---- > > Key: DDLUTILS-127 > URL: http://issues.apache.org/jira/browse/DDLUTILS-127 > Project: DdlUtils > Issue Type: Bug > Components: Core - SqlServer > Reporter: Christoffer Hammarstr=C3=B6m > Assigned To: Thomas Dudziak > Fix For: 1.0 > > Attachments: DDLUTILS-127.patch > > > Could not drop object 'Tmp_categories' because it is referenced by a FORE= IGN KEY constraint. Query: IF EXISTS (SELECT 1 FROM sysobjects WHERE type = =3D 'U' AND name =3D 'Tmp_categories') > BEGIN > DECLARE @tablename nvarchar(256), @constraintname nvarchar(256) > DECLARE refcursor CURSOR FOR > SELECT object_name(objs.parent_obj) tablename, objs.name constraintname > FROM sysobjects objs JOIN sysconstraints cons ON objs.id =3D cons.con= stid > WHERE objs.xtype !=3D 'PK' AND object_name(objs.parent_obj) =3D 'Tmp_= categories' OPEN refcursor > FETCH NEXT FROM refcursor INTO @tablename, @constraintname > WHILE @@FETCH_STATUS =3D 0 > BEGIN > EXEC ('ALTER TABLE '+@tablename+' DROP CONSTRAINT '+@constraintname= ) > FETCH NEXT FROM refcursor INTO @tablename, @constraintname > END > CLOSE refcursor > DEALLOCATE refcursor > DROP TABLE Tmp_categories > END; --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= p://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira