Editorials

I Didn’t Expect That

I was listening to a radio show this morning where the topic was about things we do that trigger other actions you would not think could or would happen. When it comes to computer systems, this is a regular occurrence. Things are often tied together in ways you may not anticipate.

In SQL Server, a fun example is the use of @@IDENTITY. This global variable is supposed to provide you with the last auto-number (identity) assigned when you perform an insert statement. What may be unknown to you is that the table has a trigger that fires when you insert a record. The trigger inserts a record into another table with an IDENTITY column. The identity value from the second insert is the one that is returned when you read the variable @@IDENTITY.

I’ve had times when I was required to fix a poorly performing stored procedure on a production database because it was radically impacting application performance. I work hard on getting a change quickly, and make sure it works correctly on a test system. The change is approved and moved into production. A few days later we receive a new bug report, and find it was introduced by the modification, because the modified procedure was used in another fashion of which we weren’t aware.

What would you say your biggest surprise has been? What un-intended or un-expected consequence have you experienced? Share with us here, or drop an Email to btaylor@sswug.org.

Cheers,

Ben