ODBC error when altering a column in Enterprise Manager

  • We are having this problem on one server and not on others - hoping someone has an answer.  There test table consists of two columns:

    create table test

    (

     col1 int IDENTITY(1,1) NOT NULL,

     col2 char(10) NULL,

     constraint [PK_Test] PRIMARY KEY

       (col1)

    )

    When we try to change the data type of col2 to anything else through Enterprise Manager, the following error displays:

    'Test' table

    - Unable to create index 'PK_Test'. 

    ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Table 'Test' already has a primary key defined on it.

    [Microsoft][ODBC SQL Server Driver][SQL Server]Could not create constraint. See previous errors.

    However, if we save the change script and run it, it works fine.

  • This was removed by the editor as SPAM

  • I've had past issues with CONSTRAINTS, where you may need to drop the constraint first before altering the table.

    Peter

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply