Jane Dallaway

Jane Dallaway

Jane Dallaway  //  Service Delivery manager, photographer, dog owner, gardener, reader, learner, software developer and occasional snowboarder

This blog contains all sorts of bits and bobs, from development related stuff, through process and productivity stuff, to photography stuff, and general inspiration things. It's a bit all over the place with no real theme, but then so am I

Email: jane @ dallaway.com
Also at:    

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 the
SET 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=0

As 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.

0 comments

Leave a comment...