Hi, I need to convert a string to an integer.
I've tried using CAST and CONVERT but the problem is that my data also contains alphanumeric characters, in wich case I want the result of the conversion to be 0.
The above commands gives an error if the data is not pure numeric.
What can I do

string to int????
Sat-Bangalore
--
Hugo Kornelis, SQL Server MVP
KavitaRavi
--
Adam Machanic
Pro SQL Server 2005, available now
http://www..apress.com/book/bookDisplay.html bID=457
--
Julio Molinero
allan k lindgren
select case when isnumeric(i)=1 then cast(i as int) else 0 end
from(
select '123' i
union all select 'abc123'
)tb
Venksys
I've solved the problem with these stament:
(CASE WHEN ISNUMERIC(x.p1)=1 THEN CAST(x.p1 AS int) ELSE 0 END)
Thanks.