How to disable identity for all tables in a database

  • We need to disable all tables identity properties. What we do now is for each table we SET IDENTITY_INSERT ON and for each table we generate insert / select list.

    Is there a better, easier way to accomplish this, like database level settings, etc ?

    Thanks

  • First, why do you need to do this? It doesn't make sense to have created tables with IDENTITY and then disable it to insert data. The whole purpose of IDENTITY is to generate the value.

    Second, you can only have one table with the IDENTITY_INSERT property set to ON in a session. So, no - there really is no other way to do what you are doing.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

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

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