Re: [GENERAL] data type serial

1999-09-22 Thread Michael

  
  So how do you store something in data type serial?
  I've created the column but everytime I attempt to do an update I get 
  back the error message that I can't store a duplicate key.
  
  table_col_seq.last_value = 1
  increment = 1
  maxvalue = 2billion something
  
  I've tried storing 1,2,some other number in "serial" in the main 
  table to no avail. What is the magic to get this to work. There 
  appears to be no documentation anywhere on the necessary SQL commands 
  to cycle the generator. I've tried the method used for Oracle SQL but 
  that does not work. I'm a bit of a newbie at this.
  
  Michael
  [EMAIL PROTECTED]
 
 You cant insert into a serial as far as I know.
 
 The serial is simply incrimented automatically whenever a new INSERT
 is done on the table.

Hmmm that's a real problem when adding it to an existing table. 
The values I get back on a select indicate all blanks. I've got 
several hundred records in the table at the moment. There must be a 
way to update the darn things.

Michael
[EMAIL PROTECTED]





Re: [GENERAL] data type serial

1999-09-22 Thread Teodor Cimpoesu

Michael wrote:
 
  
   So how do you store something in data type serial?
   I've created the column but everytime I attempt to do an update I get
   back the error message that I can't store a duplicate key.
  
   table_col_seq.last_value = 1
   increment = 1
   maxvalue = 2billion something
  
   I've tried storing 1,2,some other number in "serial" in the main
   table to no avail. What is the magic to get this to work. There
   appears to be no documentation anywhere on the necessary SQL commands
   to cycle the generator. I've tried the method used for Oracle SQL but
   that does not work. I'm a bit of a newbie at this.
  
   Michael
   [EMAIL PROTECTED]
 
  You cant insert into a serial as far as I know.
 
  The serial is simply incrimented automatically whenever a new INSERT
  is done on the table.
 
 Hmmm that's a real problem when adding it to an existing table.
? you can create another serial, starting @ max(serial attr)+1
 The values I get back on a select indicate all blanks. I've got
 several hundred records in the table at the moment. There must be a
 way to update the darn things.
it should not, how do you make that select 7 what's the table
definition?
 
 Michael
 [EMAIL PROTECTED]
 
 

-- 
CIMPOESU Teodor, Web Programmer (h)
@ DIGICOM S.A. Bucharest, Romania
@ Internet, site development
@ [EMAIL PROTECTED], +(401)-330.47.28

official home page ~ http://www.digiro.net/
Internet web  page ~ http://internet.digiro.net/






Re: [GENERAL] data type serial

1999-09-22 Thread Charles Tassell

If you have this table:

create table testing (
id  serial,
datatext,
md  int
);

You would use:

insert into testing (data, md) values ('my_data', 12);
insert into testing (data, md) values ('more data', 15);

The key part is that you don't specify the serial field in your insert command.

Anyway, hope this helps.


At 09:45 PM 9/22/99, Michael wrote:
  
  So how do you store something in data type serial?
  I've created the column but everytime I attempt to do an update I get 
  back the error message that I can't store a duplicate key.
  
  table_col_seq.last_value = 1
  increment = 1
  maxvalue = 2billion something
  
  I've tried storing 1,2,some other number in "serial" in the main 
  table to no avail. What is the magic to get this to work. There 
  appears to be no documentation anywhere on the necessary SQL commands 
  to cycle the generator. I've tried the method used for Oracle SQL but 
  that does not work. I'm a bit of a newbie at this.
  
  Michael
  [EMAIL PROTECTED]
 
 You cant insert into a serial as far as I know.
 
 The serial is simply incrimented automatically whenever a new INSERT
 is done on the table.

Hmmm that's a real problem when adding it to an existing table. 
The values I get back on a select indicate all blanks. I've got 
several hundred records in the table at the moment. There must be a 
way to update the darn things.

Michael
[EMAIL PROTECTED]









Re: [GENERAL] data type serial

1999-09-22 Thread Michael Simms

 
   
   So how do you store something in data type serial?
   I've created the column but everytime I attempt to do an update I get 
   back the error message that I can't store a duplicate key.
   
   table_col_seq.last_value = 1
   increment = 1
   maxvalue = 2billion something
   
   I've tried storing 1,2,some other number in "serial" in the main 
   table to no avail. What is the magic to get this to work. There 
   appears to be no documentation anywhere on the necessary SQL commands 
   to cycle the generator. I've tried the method used for Oracle SQL but 
   that does not work. I'm a bit of a newbie at this.
   
   Michael
   [EMAIL PROTECTED]
  
  You cant insert into a serial as far as I know.
  
  The serial is simply incrimented automatically whenever a new INSERT
  is done on the table.
 
 Hmmm that's a real problem when adding it to an existing table. 
 The values I get back on a select indicate all blanks. I've got 
 several hundred records in the table at the moment. There must be a 
 way to update the darn things.
 
 Michael
 [EMAIL PROTECTED]
 
 
 

You could create a new table with the same attributes as the old, but with
the serial in it, then insert into newone  select from oldone...

Then drop the old one and rename the new one

That SHOULD do it (Ive not tried, I think it will tho)

~Michael