Add column error

  • I have found a little bug in sql server 2008 that was not in the previous versions.

    When I try to add a new column to an existing table, "WITH no Rows", I get a FK constraint error.

    When creating the new column i set the column to allow nulls and give it a default value.

    As of now I have forced to drop all the references and the rebuild the table.

    Anyone got a work-around?

    Dam again!

  • I found a way to do it.

    -- Add a new column to the table

    ALTER TABLEdbo.utbStorefrontDoor

    ADD OverAllHeight varchar(10) NULL

    GO

    Just use code and not the designer.

    Dam again!

  • By default in SQL Server 2008, if you add a column in the designer that requires SQL Server to drop and recreate a table, the statement will fail. Not sure if that is exactly the issue you were having. There is an option you can change to allow the table drop.

    Open the Tools menu in SSMS and select Options. Under Designers, select Table and Database Designers. Uncheck the option "Prevent saving changes that require table re-creation" and see if this allows you to add the column.

    Actually, you have me interested. I am going to try to create some tables and duplicate the problem. Are both of the tables empty? Can you post the create script for the tables and the relationship?

  • That is exactly what i am experiencing .

    Thanks for the notes...

    I will have to be carefull with this. Becuase dropping a table to add a column seems a bit much.

    Dam again!

  • Do you know if unchecking the option fixed the problem?

  • I have not give it a shot yet becuase I am finializing an app. Switching gears may dislocate brains cells... 😉

    Dam again!

Viewing 6 posts - 1 through 5 (of 5 total)

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