Okay let's say that you are incrementing the primary key in the first table 
upon an insert, and then you want to insert the value of that key into the 
second table as var_id, what you have to do is after you did the first 
insert, you need to

select max(variable) as new_var_id from table1

This is done to get the value of the primary key that was created on the 
insert, there is no other way to get that value.

Then you insert new_var_id as var_id into table2

I hope this is what you are looking for. I assume the reason it is inserting 
0 is because you have the field set to default to zero when the value is not 
passed.

HTH

Donnie Bachan
Phone: (718) 217-2883
ICQ#: 28006783
"Nitendo Vinces - By Striving You Shall Conquer"
======================================================================
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to