> > On 04/05/2008 08:00 PM, Peter wrote:
> > > On 04/05/2008 07:05 PM, Grant wrote:
> > >> Is there a way to increment an integer like 000001 to end up with
> > >> 000002? The integer is stored in a MySQL table.
> > >
> > >
> > > Of course, there's a few different ways. If you give some more
> > details
> > > of what you're trying to do, though, it will be easier to give an
> > > appropriate answer to your question. Where do you want the
> increment
> > to
> > > occur, and when, etc?
> >
> > I'll give you a bit of code you can use in perl to do it:
> >
> > $i = sprintf('%0' . length($i) . 'd', $i + 1);
> >
> > Peter
>
> UPDATE table
> set mynumber = mynumber + 1
> WHERE mycode = 123
>
Heh, not quite right Pal, maybe you mean:
UPDATE table
SET mynumber = LPAD(mynumber + 1, LENGTH(mynumber), '0')
WHERE mycode = 123
/me looks both ways first...
Paul
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.