View Single Post

   
  #1 (permalink)  
Old 02-29-2008, 06:16 PM
jim_geissman@countrywide.com
 
Posts: n/a
Default Int to char conversion

I have data tables that include ZIP code, as char(5). The values look
like integers, but they are padded with leading zeroes to fill out 5
characters, '00234'.

There are SPs to look up data, with @Zip char(5) among the parameters.
Some users call these with integer values, @Zip = 234, and SQL makes
the conversion. Is it necesary to add the leading zeroes in the SP --
@Zip=RIGHT('00000'+@Zip,5) -- or would SQL find this match? (234 =
'00234'). It looks like the conversion is to '234' and the match
fails.

Thanks,
Jim Geissman
Countrywide

Reply With Quote