varchar to int conversion
hi all,
i have column in table of type varchar(255). need insert data table table , column type @ destination int. used following sql says columnname
conversion failed when converting varchar value '212' data type int.
select case when columnname in ('na', '') '0' else cast(columnname as int) end
from table
i have value 212 in column why having trouble converting it? please advise, in advance.
there invisible characters in column, numbers ok here.
take @ blog post extract numbers string
extracting numbers sql server
premature optimization root of evil in programming. (c) donald knuth
naomi nosonovsky, sr. programmer-analyst
my blog
SQL Server > Transact-SQL
Comments
Post a Comment