CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Postgresql and auto increment (aka sequence)

Print topic Send  topic

Author Message
Cricketer
Posted: 04/30/2002, 4:01 PM

I have created a basic table (cricketer_id, name, club) with the primary key being an auto incremented number and here is the code below:

CREATE SEQUENCE "cricketer_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
CREATE TABLE "cricketers" (
"cricketer_id" int4 NOT NULL DEFAULT NEXTVAL('cricketer_id_seq'),
...(blah blah .. more sql statements)

How do I make adding a new cricketer automatically give the "cricketer_id" a unique incremented number?

I found below line in the help file but couldn't quite figure out how/where to use it.

fldPK=dlookup("dual", "sequence.nextval", "")
Nicole
Posted: 05/02/2002, 3:35 AM

Hello,
just select cricketer_id field on CC record form as 'Key' field and set its type to Hidden. CC will generate all the necessary code for you.

As for mentioned code it could be used in Before Insert event to retrieve the sequence value that is to be inserted (e.g. when you want to pass it from the form).

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.