From ddlutils-dev-return-1326-apmail-db-ddlutils-dev-archive=db.apache.org@db.apache.org Wed Jan 31 06:10:27 2007 Return-Path: Delivered-To: apmail-db-ddlutils-dev-archive@www.apache.org Received: (qmail 11320 invoked from network); 31 Jan 2007 06:10:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jan 2007 06:10:26 -0000 Received: (qmail 39264 invoked by uid 500); 31 Jan 2007 06:10:33 -0000 Delivered-To: apmail-db-ddlutils-dev-archive@db.apache.org Received: (qmail 39244 invoked by uid 500); 31 Jan 2007 06:10:32 -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 39233 invoked by uid 99); 31 Jan 2007 06:10:32 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jan 2007 22:10:32 -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; Tue, 30 Jan 2007 22:10:26 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C36BC7142B5 for ; Tue, 30 Jan 2007 22:10:05 -0800 (PST) Message-ID: <21137068.1170223805797.JavaMail.jira@brutus> Date: Tue, 30 Jan 2007 22:10:05 -0800 (PST) From: "Jun Li (JIRA)" To: ddlutils-dev@db.apache.org Subject: [jira] Updated: (DDLUTILS-153) Changing column data type fails if there were indices referencing the column. In-Reply-To: <21215786.1170223505893.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DDLUTILS-153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jun Li updated DDLUTILS-153: ---------------------------- Environment: SQL Server 2000 DB with mssqlserver-2.2.0040 jdbc driver. (was: SQL Server 2000.) Adding jdbc driver info. > Changing column data type fails if there were indices referencing the column. > ----------------------------------------------------------------------------- > > Key: DDLUTILS-153 > URL: https://issues.apache.org/jira/browse/DDLUTILS-153 > Project: DdlUtils > Issue Type: Bug > Components: Core - SqlServer > Environment: SQL Server 2000 DB with mssqlserver-2.2.0040 jdbc driver. > Reporter: Jun Li > Assigned To: Thomas Dudziak > > Creating a database using the following schema: > > > > > > > > > > > > >
> > > >
>
> ************************************************* > And then change the data type of id column of organisation table from 'Numeric' to 'Integer' resulting the following schema: > > > > > > > > > > > > >
> > > >
>
> ************************************************ > The sql statements generated by using platform.getAlterTablesSql() API are as follows: > IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'F' AND name = 'FK_Persion_Org') > ALTER TABLE person DROP CONSTRAINT FK_Persion_Org; > ALTER TABLE person > ALTER COLUMN organisation_fk INT; > ALTER TABLE organisation > ALTER COLUMN id INT NOT NULL IDENTITY (1,1) ; > ALTER TABLE person > ADD CONSTRAINT FK_Persion_Org FOREIGN KEY (organisation_fk) REFERENCES organisation (id); > *********************************************** > There were two problems with the above statements when trying to run it in the SQL Query Analyzer: > 1. > Server: Msg 156, Level 15, State 1, Line 8 > Incorrect syntax near the keyword 'IDENTITY'. > 2. > Server: Msg 5074, Level 16, State 8, Line 4 > The index 'IX_Person_Org' is dependent on column 'organisation_fk'. > Server: Msg 4922, Level 16, State 1, Line 4 > ALTER TABLE ALTER COLUMN organisation_fk failed because one or more objects access this column. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.