|
|
Sponsor |
Re: Auto-incrementing field: msg#00247db.postgresql.novice
Yes.. Try SERIAL datatype. test=# Create Table test (my_auto SERIAL,Name text); NOTICE: CREATE TABLE will create implicit sequence 'test_my_auto_seq' for SERIAL column 'test.my_auto' NOTICE: CREATE TABLE/UNIQUE will create implicit index 'test_my_auto_key' for table 'test' CREATE test=# insert into test(name) values ('Denis'); INSERT 13170208 1 test=# select * from test; my_auto | name ---------+------- 1 | Denis (1 row) Note : It implicitely creates SEQUENCE and associate it with the field. But if you drop the table, you need to drop the SEQUENCE manually.. it does not drop it automatically.. Denis ----- Original Message ----- From: "Jim Steil" <jim.steil@xxxxxxxxxxxxxx> To: <pgsql-novice@xxxxxxxxxxxxxx> Sent: Saturday, July 27, 2002 1:19 AM Subject: [NOVICE] Auto-incrementing field > Is there a data type in PostgreSQL that will 'auto-increment'? I have used > this in MS SQL Server in the past and would like to continue to do so with > PostgreSQL. Thanks for any help... > > -Jim > > Jim Steil > CustomCall Data Systems > (608) 274-3009 > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your > message can get through to the mailing list cleanly ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Trigger question, denis |
|---|---|
| Next by Date: | Changing Database Name, James Kelty |
| Previous by Thread: | Re: Auto-incrementing field, Aarni Ruuhimäki / Megative Tmi / KYMI.com |
| Next by Thread: | Still problems with pg_dump ad \dt..., Wim |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|