Hi Ali,
Thank you for using MSDN Newsgroup! It's my pleasure to assist you with your issue.
First of all, I would like to thank all for their help!
From your description, I notice that you received the 8114 error when you converted a Varchar
column to Numeric format.
Based on my research, CAST or CONVERT a varchar column to a Numeric format
DIRECTLY, which used to work in SQL Server 6.5, are no more working in 7.0 and 2000. For
example: Select CONVERT(float, '21ABC') would return 21.0 as output in 6.5.
However, the same statement fails in 7.0 and 2000 with the following error as yours:
Server: Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
The SAFE way to workaround this problem is to make sure you are passing valid data to the
CAST or CONVERT function. I recommend you apply the following suggestions to filter the
data and send the valid data to CAST function:
1. First use IsNumeric(job.udf1) to filter the Varchar data
2. Filter the marks such as a SINGLE '.' and ',' in the WHERE clause. You can perform like that:
WHERE IsNumeric(job.udf1)=1 and job.udf1 <> '.' and job.udf1 <> ','
3. Replace other delimiters (such as comma ',') with pot '.' so that it is valid when it passes to
the CASE function. You can do the following: REPLACE(job.udf1, ",",".").
On the other hand, you can also filter the Integer data by means of LIKE/NOT LIKE in the
WHERE Clause like that:
SELECT job_no,job.udf1
FROM job
WHERE job.udf1 NOT LIKE '%[^0-9]%'
Does that answer your question Ali? Please apply my suggestion above and let me know if it
helps you resolve your problem. If there is anything more I can assist you with, please feel free
to post it in the group.
Regards,
Billy Yao
Microsoft Online Partner Support
----------------------------------------------------
Get Secure! -
www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.