GeeeeeeeeekSo an interesting problem came up at work yesterday... our production database has 3 copies: the database that's actually used by the application, and two more that are updated live by replication (which just means that any changes made to the first database are made to the other 2 as well). And it turns out that one of the systems sending us information started sending "NaN" (Not a Number, e.g. 0 / 0) values for one of its fields. These NaN values made it all the way into the database, where they proceeded to break replication. But what made it really interesting is that there is no easy way to find NaN values in a Sybase database using SQL queries. I couldn't find anything about it online, and even our database architect didn't know how to do it. But I finally figured out a way:select * from Leg where reverse(str(leg.fixedRate)) like "NaN%" That works because the string value of NaN is something like " -NaN" (for Sybase 12, anyway). Of course it's not an ideal solution since the table has about 4.5 million rows and the index on fixedRate doesn't help when it has to be converted to a string... but there are other ways of optimizing the query, and finding the NaN values was the important part. In (slightly) less geeky news, Fallout 3 has consumed me. It's at least as addicting as Fable II was, but with a much more massive map. |
|
