I have a table that is updated on a regular interval. I need to set an
overall ID that increments by 1, such as 0001, 0002, etc. I need a second ID
that does similarly, incrementing by 1 (such as 20001, 20002, 20003), but
which also resets to 20001 for each new update interval.
ThanksFor a heavy usage system, this could be costly.
Anyway, you could create an update trigger and increment the columns as
desired.
e.g.
create trigger _u on tb
for update
as
update tb
set colx=right(10001+cast(colx as int),4)
from tb,inserted i
where tb.pk=i.pk
go
-oj
"HollyylloH" <HollyylloH@.discussions.microsoft.com> wrote in message
news:AE05B6DD-30F4-45A3-94D3-AE1AD09BC31F@.microsoft.com...
>I have a table that is updated on a regular interval. I need to set an
> overall ID that increments by 1, such as 0001, 0002, etc. I need a second
> ID
> that does similarly, incrementing by 1 (such as 20001, 20002, 20003), but
> which also resets to 20001 for each new update interval.
> Thankssql
No comments:
Post a Comment