I have a field of text and I want to prefix the that text with numbers padded
with zeroes.

eg currently
text 1
text 2
text 3

to become
001 text 1
002 text 3
003 text 2

or ultimately
b001 text 1
b002 text 3
b003 text 2


Igor Tandetnik ([EMAIL PROTECTED]) wrote:
>
> Brian Johnson wrote:
> > I need to update a char field to add integer prefixes, but I need to
> > pad them with zeroes so I can sort them.
>
> I'm not exactly sure what you are trying to do, but this would perhaps
> give you an idea:
>
> update table set field=substr('00...0' || field, -20, 20)
>
> assuming you want your fields padded to 20 characters wide. Here
> '00...0' is a string consisting of 20 '0' characters.
>
> Igor Tandetnik
>
>

Reply via email to