First option, I don't think, is possible.
Reg. 2, You can get MAX(Id) before inserting, increment it by 1 in your
script and then Insert 'gc<Id>' as the invoice_id value.

Bhavin.
----- Original Message -----
From: "MySQL List" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 7:23 PM
Subject: Help With Default Value


I am trying to do one of two things.

First I'd rather do this, but if not possible, then the other way that
I'll describe will suffice.

1) I need to have a default value of a column named "invoice_id" be this:
Column names of importance:
id    invoice_id

id is auto_increment and BIGINT unsigned.
invoice_id needs to be "gc"+ id

How can I have invoice_id have that as default? in other words if it's
inserting data into that table, and
it's the first record, then id would = 1. So I need invoice_id to be
gc1

Is that possible?

2) If 1 is not possible, then how can I get the value of id of the one I
just inserted? Is it possible to get that at the same
time as I insert it, so I can then UPDATE that invoice_id with the correct
data?

If I need to clarify this, please by all means do let me know.

Thank you, kindly,
Richard



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to