I think you might find that SQL server is doing an implicit cast to an Int, I've see this at times when comparing numeric strings and Integers,
If you take the simple example,
Then Joe is correct SQL Server will give you a conversion error "Conversion failed when converting the varchar value 'A' to data type int."
That leads me to beleive that SQL server is doing an implict conversion under the bonnet of an Aplhanumeric field types if one of the parameters is a numeric data type, as it needs to be able to match like for like.
Unfortunately a blank string (even one just full of spaces), of any type will convert to 0, just do Print convert(int, '') (or CAST('' as Int) and SQL Server will return 0 every time.
I can understand the logic of the background convert, but dont understand strings just contianing spaces or empty string get cast to 0, as if you do PRINT ASCII('') it returns 32, indicating that there is a space in the string,
I can only conclude that this is a piece of legacy functionality in the code base, does anyone know if any other databases do this type of converstion?
_________________________________________________________________________SSC Guide to Posting and Best Practices