Home > Archive > SQL Anywhere database > December 2005 > Which system table contains the last used auto increment value for a field?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Which system table contains the last used auto increment value for a field?
E. ten Westenend

2005-12-27, 7:23 am

Hi

Which system table contains the last used auto increment value for a field?



Eric


E. ten Westenend

2005-12-27, 7:23 am

Hi

I believe it is the SYSCOLUMN table, field max_identity.


Eric


"E. ten Westenend" <ewestenend@bcsbv.nl> schreef in bericht
news:43b11cf3$1@foru
ms-1-dub...
> Hi
>
> Which system table contains the last used auto increment value for a

field?
>
>
>
> Eric
>
>



E. ten Westenend

2005-12-27, 7:23 am

Hi,

i noticed this value is not updated every time a new record is inserted.
Most likely is that SQL Anywhere is cashing until connection is dropped.
So this field can not be used to read the value after an insert.

Eric

"E. ten Westenend" <ewestenend@bcsbv.nl> schreef in bericht
news:43b121bf$1@foru
ms-1-dub...
> Hi
>
> I believe it is the SYSCOLUMN table, field max_identity.
>
>
> Eric
>
>
> "E. ten Westenend" <ewestenend@bcsbv.nl> schreef in bericht
> news:43b11cf3$1@foru
ms-1-dub...
> field?
>
>



Breck Carter [TeamSybase]

2005-12-27, 9:23 am

AFAIK it is up to date after a checkpoint. However, you may not be
able to guarantee that the value you have retrieved from SYSCOLUMN
accurately reflects the column value since another connection could be
busy inserting rows. If you really wanted to, you could do a LOCK
TABLE to block inserts, CHECKPOINT to force SYSCOLUMN to be updated,
SELECT the value, then COMMIT to release the lock... the value would
be correct between the SELECT and the COMMIT.

If it is a single-connection database, a CHECKPOINT would be
sufficient.

Breck

On 27 Dec 2005 03:33:20 -0800, "E. ten Westenend"
<ewestenend@bcsbv.nl> wrote:

>Hi,
>
>i noticed this value is not updated every time a new record is inserted.
>Most likely is that SQL Anywhere is cashing until connection is dropped.
>So this field can not be used to read the value after an insert.
>
>Eric
>
>"E. ten Westenend" <ewestenend@bcsbv.nl> schreef in bericht
> news:43b121bf$1@foru
ms-1-dub...
>


--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/A...7/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com