spu_generateinsert - identity columns can now be ignored
One of my colleagues suggested an update to spu_generateinsert before Christmas, and today was the first time I got a chance to script it. The suggestion was to prevent IDENTITY columns from being scripted.
I've added a new parameter to the procedure, named @GenerateIdentityColumn, which I have set to default to 1. This means it maintains the current behaviour. If you set it to 0 though, you will no longer get theSET IDENTITY_INSERT [tablename] ON
and
SET IDENTITY_INSERT [tablename] OFF
statements, and the identity column itself will not be included in the script, which means that the database will assign the relevant value.Example usage is
exec spu_GenerateInsert @table ='users', @generateGo=0, @restriction='columna = x', @producesingleinsert=0, @debug=0, @GenerateOneLinePerColumn=0, @GenerateIdentityColumn=0As ever this is work in progress, so please continue sending in your suggestions and I'll attempt to implement them.Download the script from here.