Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sequence in Sybase

786 views
Skip to first unread message

Firinde Teylouni

unread,
Sep 11, 1997, 3:00:00 AM9/11/97
to

Is there any mechanism in Sybase that allows to create a sequence
similar to ORACLE sequences.

Thanks in advance.

Michael Shael O'Neill Selden

unread,
Sep 11, 1997, 3:00:00 AM9/11/97
to

Firinde,
I'm not exactly sure what Oracle "sequences" are, but it sounds
like it might be similar to SYBASE IDENTITY columns, defined in the
vendor documentation thusly:

"IDENTITY columns contain system-generated values that uniquely
identify each row within a table. They are used to store sequential
numbers...that are generated automatically..."

You can find the IDENTITY related SYBASE documentation on-line
at: http://sybooks.sybase.com/cgi-bin/nph-dynaweb/srv11009/sqlref/63195.
I hope this helps.

Michael.
--
Michael Shael O'Neill Selden, SA, DBA, JAPH, DAD
sel...@instinet.com
Remove "NOSPAM." From Address To Return Mail
PGP Public Key Available Upon Request

Bret Halford

unread,
Sep 11, 1997, 3:00:00 AM9/11/97
to

In article <3417A4...@elca-matrix.ch>, Firinde Teylouni <firinde....@elca-matrix.ch> writes:
|> Is there any mechanism in Sybase that allows to create a sequence
|> similar to ORACLE sequences.

Without any details on how Oracle sequences work, it is difficult
to answer the question.

However

1) You can add an identity column to the table that increments
as rows are added. Deleted rows will cause gaps in the sequence,
but if you order by identity, the rows will be in insert order.

2) You can add a timestamp column to the table. The rows that have
most recently been inserted or updated will have the highest timestamp,
and you can order by timestamp.

3) You can select rows into a work table and add an identity column
to the worktable. Until the table is modified, the identity values
will form a gapless sequence.

--
---------------------------------------------------------------------
| Bret Halford Imagine my disappointment __|
| Sybase Technical Support in learning the true nature __|
| 6400 S. Fiddlers Green Circle of rec.humor.oracle... __|
| Englewood, CO 80111-4954 USA |
============================================================


amit kothari

unread,
Sep 11, 1997, 3:00:00 AM9/11/97
to firinde....@elca-matrix.ch

Firinde Teylouni wrote:
>
> Is there any mechanism in Sybase that allows to create a sequence
> similar to ORACLE sequences.
>
> Thanks in advance.


Sure, it is called an identity col in a table, eg. -

create table a(col1 numeric(5,0) identity,
col2 char(1))

now do
insert into a values('a') etc
and col1 will be automatically generated.

regards

amit
--
_______________________________________________________________________________
Truth is self-evident; nonviolence is its maturest fruit, it is
contained in Truth, but is not self-evident. - Gandhi

My Home Page: http://www.geocities.com/ResearchTriangle/4960/
_______________________________________________________________________________

Tim Carroll

unread,
Sep 12, 1997, 3:00:00 AM9/12/97
to

The Identity Column is much like the Oracle sequence.....
Create a column with datatype numer(10,0) and make it an
identity column....


Firinde Teylouni wrote in article <3417A4...@elca-matrix.ch>...

0 new messages