Sunday, May 17, 2009

Ab-normalization at Experts Exchange - part 14

Question today: How would you run an update query in Access

A questioner want to update in a field the value -1 to 215 and 0 to Null

The proposed queries by a real expert:
UPDATE tblethnicitycopy SETintFatherNEuropean = Null WHERE intFatherNEuropean= 0
UPDATE tblethnicitycopy SETintFatherNEuropean = 250 WHERE intFatherNEuropean= -1

doesn't work as there's no space after the SET command :-(

But crappy has a working copy/paste solution:
UPDATE tblethnicitycopy
SET intFatherNEuropean = iif([intFatherNEuropean]=-1,250, Null)

He just forgot that all other values (not being -1) will turn into Null too .
That's what I call a beginners mistake, but did I even thought he was an expert?

The questioner added a question:
Now I see why you have > 1,000,000 points. Another great solution to a difficult issue.
Could you tell me why the standard approach I tried ~ to the shambalad solution does not work and
your solution does work?

Like my previous blog article did point out, there's no additional comment from crappy, as he's got his points

Thanks to crappycorn1 I had my daily laugh, so please keep on commenting crappy

Nic;o)
Still proud to be suspended from this "quality site" where wannabee experts rule and "quality" is just another word from the dictionary.
(The question can be found at: http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_24413706.html)

No comments:

Post a Comment