PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Doug Fairclough <kensey at clearstation dot com>
Subject: next key table
Date: Sep 18 1997 5:28PM

http://www.sybase.com/products/whitepapers/pkey_wpaper.html

states that :

begin tran 

    declare @next_key
    update next_key set next_key = next_key + 1
    select @next_key = next_key + 1 from next_key 

    insert into data_table (key_column, ...) values (@next_key, ...) 

commit tran 

does anyone know if its necessary to have the 'insert' statement
_within_ the transaction in order to gaurantee uniqueness in the
keys generated ?

i have code that does the above, but i dont have my insert statements
within 'begin tran' and 'commit tran' but after it.

thanks !

doug