I am using Cold Fusion and as I stated in my original message, if I were
using MySQL 5, then I could use information_schema to retrieve the
column names in the table and do it with variables in Cold Fusion. I do
that on all my pages on the MySQL 5 servers with which I work. However,
the server I am working with currently is MySQL 4 and I am unaware of
any way to retrieve the column names from a table in MySQL 4.

Rob

Danny Stolle [mailto:[EMAIL PROTECTED] wrote:

Well I haven't realy found a select method in which you can isolate a 
field. Like a complementary method, in which you select like one field, 
but shows the fields except the field which you have used in your 
select-statement.

So you excually want to dynamically insert the records, not knowing how 
many fields you excually have; excluding the auto-numbering field. 
Wouldn't it be better to use PHP or another API in which you retrieve 
the fields and create an SQL statement using these variables and having 
the knowledge of creating the sql-statement?

You could also try to automate an export and use the load datafile to 
import the information; but then again you have to rewrite the datafile.


Best regards, Danny


Schimmel LCpl Robert B (GCE 2nd Intel Bn Web Master) wrote:
> That is the effect that I am looking for, but exactly the method that
I
> am trying to avoid. If I type the column names into my INSERT...
SELECT
> and someone later adds a column to the table, I would have to go back
> into my program and update the statement. I am looking for a way to do
> it dynamically in order to avoid maintenance of the statement in my
> program later.
> 
> Rob
> 
> 
> Danny Stolle [mailto:[EMAIL PROTECTED] wrote:
> 
> Hi,
> 
> I am hoping you meen this:
> 
> You have to use the fields in your into -statement and select
statement,
> 
> not including the field having the auto-numbering
> 
> so if e.g. field1 has autonumbering ->
> insert into table1 (field2, field3) select (field2, field3) from
table1;
> 
> autonumbering will automatticaly be applied :-)
> 
> Danny
> 
> Schimmel LCpl Robert B (GCE 2nd Intel Bn Web Master) wrote:
> 
>>Here is the problem that I am having. I am trying to make a copy of a
>>full record in a table that has a primary key with auto-increment. The
>>real problem is that I want the statement to use SELECT * so that if
>>columns ever get added to the table the statement will still work for
>>the full record. I know that I can use the information_schema to do
> 
> this
> 
>>in MySQL 5, but the server I am currently work with is MySQL 4.
>>Basically, I am looking for a way to select all of the columns in a
>>record except one, so that the auto-incrementing primary key will
>>automatically insert itself. Of course, if anyone has any other
>>suggestions for a work around, that would be good, too.
>>
>> 
>>
>>Rob Schimmel
>>
>>2d Intel bn
>>
>>USMC
>>
>>
> 
> 

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

Reply via email to