Need help with script alter and drop

  • Guys I need a little bit support on this:

    My question is related to the following table:

    In the table, I have to create an item that is a meaningless primary key called ''banr''. I need a SQL script that makes this change. I have to use Alter and Drop statements, but I really do not know how I can use ALTER and DROP?

    The uniqueness rule for the columns Order, article should be retained.

    I think that I have to follow these steps but i am not sure and don't know what is the best way and how it will look like.

    1. Create a new table with primary key or ID with name ''banr'' with AUTOINCREMENT and which is meaningles, + other fields.

    2. insert into new_table and select from old table

    3. Drop old table

    4. rename new table to old table

    How can I make this script? How does it looks like? If anyone can help a little way. Many thanks!

  • We can't see (or at least I can't) your tables. Can you repost?

    EDIT: Please post table DDL (the create scripts with all keys and indexes). Pictures don't help us help you.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

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

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