Gotta do it more than once? Script it!

written by Andrew Tobin on Thursday, December 13 2007

Yesterday I spent quite a bit of time scripting up in SQL and into a stored proc some code that I tend to rewrite a bit.  What it does is shifts a lot of product from one order to another, or back into stock.

This was something that probably should have been in the system from the start, but somehow had been avoided for a long, long time.

Anyway, over the past year I was asked to move stock now and then, but my grumblings usually made them avoid the need :)

It had started to get more and more common again though, and I had a script on hand, but then rebuilt my pc forgetting one directory - the SQL Projects directory that contained my helper scripts!

Well, that convinced me and given the other day I had to redo it all over again, I made sure I turned it into a stored proc and saved it, and then added it to the application.

And one day later? They had to use it 4 times, possibly saving me a good hour of shifting things and making sure they went through okay.

And that was a saving of half a day that used to occur before I scripted it in the first place (they used to move things row by row, or copy and paste data between tables *shudders*).

Anyway, I just heard from the users that they used the new screen and it was all done in 5 minutes - no relying on me being around and doing it for them, and I can go on holidays at the end of the month without that manual procedure bothering me!

If you have to do it more than once, you really need to see if you can script it out of your way!

NB: I'm a firm believer in the fact that I should be working on the system, not in the system, so I aint doing your job for you Mr Co-Worker! ;)

Similar Posts

  1. SQL Code Camp - Day 1
  2. Code Camp Oz 2008
  3. SQL Code Camp - Day 2

Comments are closed

Options:

Size

Colors