Friday, June 17, 2011

Stupid Error Messages

Have you ever seen an error message like this one?

Invalid phone number (212) 555-1284 - not numeric
Maybe this one?
Invalid phone number 2125551284 - format not (999) 999-999
Both messages are stupid, stupid, stupid... that's three "stupids" out of a maximum possible score of 5. Modern systems should be able to deal with human-readable input formats like credit card numbers with or without the dashes.
Invalid credit card number 4533-3048-3842-9544 - not numeric

Today's Stupid Error Message


1
<br>CREATE TABLE t (<br>   pkey UNIQUEIDENTIFIER NOT NULL PRIMARY KEY );<br><br>INSERT t VALUES ( '4b67abbe3c9246f883db0ab2d2b78f8b' ); <br>GO<br><br>Msg 8169, Level 16, State 2, Server ENVY, Line 4<br>Conversion failed when converting from a character string to uniqueidentifier.<br>

You need the dashes for that when using SQL Server 2008:
1
<br>INSERT t VALUES ( '4b67abbe-3c92-46f8-83db-0ab2d2b78f8b' );<br>GO<br><br>(1 row affected)<br>

I suppose we should be grateful it accepts lower case.

For the record, SQL Anywhere has no such difficulty:
1
<br>CREATE TABLE t (<br>   pkey UNIQUEIDENTIFIER NOT NULL PRIMARY KEY );<br><br>INSERT t VALUES ( '4b67abbe3c9246f883db0ab2d2b78f8b' ); <br><br>Execution time: 0.43 seconds<br>1 row(s) inserted<br>

As they say, Watcom does things they way they should be done.


1 comment:

Anonymous said...

Why did it take 0.43 seconds to insert one row? Is there something special about uniqueidentifier that makes this slow?