• As for doing things this way versus via scripts & source-control : I think the idea of making sure you get all the @@IDENTITY usages this way isn't all too bad. It has a couple of pitfalls though. For starters you'll miss out on the encrypted objects regardless of the implementation. Secondly, via syscomments you risk losing those that have @@ID on the first line and ENTITY on the second line (if you catch my drift), and then there's the risk of case-sensitivity (or not).

    Personally I would rather go over all the source-scripts, update as needed and roll out again. Once finished with that, run the script of the poster again to identify any stray @@IDENTITY usages and either remove them from the database since they are obviously not under source-control and thus likely "illegal" or "obsolete". Or add & fix them in the source-control system and redeploy them to the databases again.

    I guess it's a matter of what you're used to ... I've also done some 'the db is the source system' projects in the past, but I've been burnt enough to realise the value of a source-control system 😀 (or in fact it was closer to :crying: at the time =)