How to set a column to be not identity...

  • In a script ?

     

     

  • Create a dummy table with an Identity. Save it. Now open the table in EM design mode and change the column to non-identity. See the 3rd toolbar icon from the left in EM ? Called "Save Change Script" in the tooltip text ? Click it and you will see the script EM generates for that action.

    If you want to know how to do something via script, do it in EM and view the resulting EM change script.

     

  • Thanks for Save Change Script tip, I did not know about this.

    But this is not exactly whah I want. The script that it generates shows "create table ..." without identity of cource.

    What I expect is like "Alter table alter column set ..." because this table already has some data. And I don't know the names of tables for which I have to do this change - the script which I am writing is finding table names for this change by some criteria.

  • Mark,

    You can't remove the identity property from a column without recreating the table.  You can use SET IDENTITY_INSERT to allow insertion values, but you can't remove the property permanently.

    Greg

    Greg

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

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