resetting sequence

Поиск
Список
Период
Сортировка
Искать

resetting sequence

От:
"Kancha ." <kancha2np@yahoo.com>
Дата:
My sequence starts from 1 and after few months it
should be reset to 1 again. Can this be automated ??

__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards�
http://movies.yahoo.com/

Re: resetting sequence

От:
Philip Hallstrom <philip@adhesivemedia.com>
Дата:
take a look at the SETVAL function... it's something close to:

SELECT SETVAL('sequence_name', 1);

something like that.  check the manual.

On Tue, 26 Mar 2002, Kancha . wrote:

> My sequence starts from 1 and after few months it
> should be reset to 1 again. Can this be automated ??
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Movies - coverage of the 74th Academy Awards�
> http://movies.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

Re: [SQL] resetting sequence

От:
"Andrew G. Hammond" <drew@xyzzy.dhs.org>
Дата:
Вложения:
It also looks like you might want to check out the unix cron utility.  
From your shell prompt, try 
man crontab

On Tue, Mar 26, 2002 at 09:30:10PM -0800, Philip Hallstrom wrote:
> take a look at the SETVAL function... it's something close to:
> 
> SELECT SETVAL('sequence_name', 1);
> 
> something like that.  check the manual.
> 
> On Tue, 26 Mar 2002, Kancha . wrote:
> 
> > My sequence starts from 1 and after few months it
> > should be reset to 1 again. Can this be automated ??
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Movies - coverage of the 74th Academy Awards�
> > http://movies.yahoo.com/
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> >
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
Andrew G. Hammond  mailto:drew@xyzzy.dhs.org  http://xyzzy.dhs.org/~drew/
56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F              613-389-5481 
5CD3 62B0 254B DEB1 86E0  8959 093E F70A B457 84B1
"To blow recursion you must first blow recur" -- me

Re: [SQL] resetting sequence

От:
"David Stanaway" <David@Stanaway.net>
Дата:

----- Original Message -----
From: Kancha . 
To: ; 
Sent: Tuesday, March 26, 2002 8:30 PM
Subject: [SQL] resetting sequence


> My sequence starts from 1 and after few months it
> should be reset to 1 again. Can this be automated ??


If the use of the sequence is predictable, you may want to alter the CYCLE
and MAXVALUE options in the seqence creation.

EG:

CREATE SEQUENCE foo MAXVALUE 3000 CYCLE;




FAQ