I have ZIP code column which is retriving as from data base but as per my requirement i wanna to display below like this.
iam having the 5 digit codes:
45612
45678,
12345,
789456123 like this
but i want to display, if eqal to 5 or more than 5 like below
78945-6123
iam using the below code but iam not getting
substring (ZIp),6,1) ='-'
can any one suggest?
Hi,
What data type is your Zip code item? I assume it's some sort of numeric field. If so, you should probably code your query calculation as follows:
if (character_length(cast([Your zip code item],varchar(15))) > 5) then (substring(cast([Your zip code item],varchar(15)),1,5) + '-' + substring(cast([Your zip code item],varchar(15)),6,5)) else (cast([Your zip code item],varchar(15)))
Cheers!
MF.
Thanks! i got it using the below code.
case when length ([ZIP Column]) >5
then substr ([ZIP Column],1,5) || '-' ||
substr ([ZIP Column],6)
else [ZIP Column]
end