Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Finally - a stupid thing in SQL Server!

Author  Topic 

davidpardoe
Constraint Violating Yak Guru

324 Posts

Posted - 2001-08-13 : 11:06:39
OK - I think I've finally found a stupid feature in SQL Server!

I have a varchar field that I wish to convert to an int. The field sometimes contains ' .' - thanks to the data supplier. I had previously written a function to check if the field is numeric before "casting" it as an int.

However...

select isnumeric(' .') returns 1

But select cast(' .' as int) returns an error

Surely if isnumeric() returns true then cast should be able to convert it? Incidentally casting as a float does not work either.

I'm using SQL2K if it makes a difference.

Any thoughts or comments?

   

- Advertisement -