|
Posted by Madhivanan on 06/21/06 09:07
Where do you want to show the data?
If you use front end application, do the numbering there
Madhivanan
newtophp2000@yahoo.com wrote:
> Alexander Kuznetsov wrote:
> > > declare @next int
> > > begin transaction
> > > update my_sequence set seq = seq + 1 where name = 'abc';
> > > select @next = seq from my_sequence where name = 'abc';
> > > commit transaction
> > >
> >
> > If you can consume numbers in batches, do it, as it is dramatically
> > more efficient. For instance, if you know up front that you need 100
> > numbers, do this:
> >
> > update my_sequence set seq = seq + 100 where name = 'abc';
> > select @next = seq - 99 from my_sequence where name = 'abc';
>
> This looks interesting. A suggestion that was very similar to this one
> came up a while ago in our project. As I remember, the developers did
> not like the idea as it introduced more work for them to manage.
>
> Thanks for the tip!
Navigation:
[Reply to this message]
|