Pervasive
Sign in | Join | Help
in

DROP INDEX IDENTITY - Restricted

Last post 05-29-2008 10:10 AM by Linda. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-29-2008 5:20 AM

    • BazE30
    • Not Ranked
    • Joined on 03-14-2006
    • Posts 4

    DROP INDEX IDENTITY - Restricted

    Hi,

    The below SQL would work for Version 8 of Pervasive and not 9.5 if the index field was the identity field.

    "DROP INDEX tablename.Index_1"

    My question is, is there an option or security integrity parameter involved???  I understand the reason its there but my background reason for wanting to do this, is that I want to recreate the entire table's index's via SQL but first I need to drop the index's.  I'm not interested in running an exe to rebuild them as I need to be able to do this via SQL commands.

    Thanks for any help!

    Barry.

     

  • 05-29-2008 7:02 AM In reply to

    • Gordon
    • Top 50 Contributor
    • Joined on 08-30-2007
    • Delft, The Netherlands
    • Posts 93

    Re: DROP INDEX IDENTITY - Restricted

    That was actually bad behaviour of prior versions.

    By removing the index the auto increment fails to function and the IDENTITY field becomes a badly tagged INTEGER field. Essentially this translates as table corruption.
     

  • 05-29-2008 8:07 AM In reply to

    • BazE30
    • Not Ranked
    • Joined on 03-14-2006
    • Posts 4

    Re: DROP INDEX IDENTITY - Restricted

    Hi and thanks for the reply,

    So would you know if there is a bypass method or a parameter that can be switched on & off, to allow this? 

    I'm thinking of just working around this now.

     
    Barry


     

     

  • 05-29-2008 9:52 AM In reply to

    • Gordon
    • Top 50 Contributor
    • Joined on 08-30-2007
    • Delft, The Netherlands
    • Posts 93

    Re: DROP INDEX IDENTITY - Restricted

    No bypass...

    With only SQL available you'll probably need to move the data around using a temp table. Best way still would be to call on the rbldcli.exe
     

  • 05-29-2008 10:10 AM In reply to

    • Linda
    • Top 500 Contributor
    • Joined on 03-04-2008
    • Posts 11

    Re: DROP INDEX IDENTITY - Restricted

    I did a little test and found that you can alter the table to change the Identity column to integer, and then it will let you drop the index.  Then, you can change it back to an Identity and it will re-add the index.  But, it's not a real clear-cut process, so I suggest you do some experimenting after making good backups of everything:

    create table t1 (c1 identity, name char(20));
    create index nx on t1 (name);
    --now there are two indexes on the file & table

     

    alter table t1 in dictionary modify c1 integer;

     

    drop index t1.uk_c1 in dictionary;
    drop index t1.nx in dictionary;
    -- now there are no indexes in the DDFs, but still two on the file

     

    alter table t1 modify c1 identity not null;
    -- after this step, the Identity index is in the table and file,
    -- but the name index is not in either; so...

     

    create index nx on t1 (name);
    -- now, it's back to the way it started.

     

Page 1 of 1 (5 items)
© 2008 Pervasive Software Inc. All Rights Reserved.