Subject Re: [firebird-support] Re: insert into with primary key
Author Martijn Tonies
>> >> >I copy a table with
>> >> >
>> >> > insert into newtable select * from oldtable
>> >> >
>> >> > The oldtable has a primary key. The newtable not.
>> >> >
>> >> > With kind regards
>> >> > Alfred
>> >>
>> >> What's the question?
>> > the newtable lost the information which is the field with
>> > the primary key.
>> > I have always to set the primary key to the field manual.
>> > If I forgot, I got trouble with the update of the newtable.
>>
>> But you created "newtable", didn't you?
>>
>> So, did you create it with a primary key?
>>
>>
>> You're not telling us much - start with your exact steps,
>> and describe closely what the problem actually is.
>
> I had a little program which save the wages of every employee
> for a month. Then I make a report for this month. Then I will
> save this data in a table example employee_2008_11, for audit
> purpose only. The maintable is always employee_2008.
>
> insert into employee_2008_11 select * from employee_2008
>
> and employee_2008_11 lost the information of the primary key.

What does this mean? Did it lose -metadata- information about
which columns are part of the primary key?

Or do the primary key -values- change when you do the INSERT?


> Every data record has 32 fields. Every field could change in every
> month. The teacher of my sun says book-keeper have special brain
> windings. I hope I could explain my little problem.


With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com