>>>I thought the following code would work, but it doesn't. Maybe one of you SQL gurus can help. I have a sql table which has a column for badge number (badgeno) it is of type char() 4 characters. I attempted to run a query from vfp like the following:
>>>
>>>select * from employees where cast(badgeno as numeric(10))>0
>>>
>>>I get an error message - Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to numeric
>>>
>>>Any ideas?
>>
>>Most likely you have none-numeric data. Run following query to find offending record(s)
>>
>>select * from employees where ISNUMERIC((badgeno) = 0
>>
>Yes, it's all non-numeric. I was looking for an isdigit() and it seems you have given it to me!
>
>Thanks once again!
Just a warning, unlike the VFP ISDIGIT() function SQL Server ISNUMERIC() check the whole value if it can be converted to numeric:
Expression VFP ISDIGIT() SQL Server ISNUMERIC
------------------------------------------------------------
'someting' .f. 0
'1someting' .t. 0
'123' .t. 1
Also SQL Server ISNUMERIC() returns 1 for the expressions like:
1e2
1d2
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.