>Hi everybody,
>
>I have this simple code
>
>
>replace dc_crdno WITH REPLICATE("*",12) + RIGHT(ALLTRIM(dc_crdno),4) FOR NOT EMPTY(dc_crdno)
>
>The problem is that I see just 12 * for some rows, so I assume that there may be some unprintable characters in that column. How can I make sure to either show 12* + 4 last digits or show empty value?
Just to eliminate the obvious nonsense... are you sure that this column is c(16) at least?
Since your command here is destructive, I assume it's running on a cursor which originally had 16 digit card numbers, probably coming from some previous select.
1) make sure that the field is made as select ...(cast dc_crdno as c(16)) as dc_crdno, so that we're sure it's not Fox measuring the first row and deciding from it how wide the column should be.
2) How about
replace dc_crdno with stuff(dc_crdno, 1, 12, replcate("*",12)) for chrtran(dc_crdno, "0123456789", "##########")=replicate("#", 16)
Not saying that this is in any way faster (surely not, with replicate() being called for each row - should put those into variables), but this should hit only 16 digit card numbers - and if you see anything else, well, then the suspicions about unwanted characters may be justified, and investigated.