Hiya
I have a problem which I'm working on which I hope someone can help with. I
have two tables in a database. For the sake of argument, let us call them
Table1 and Table2.
For each record in Table1, I want to write a record in Table2 where the
record will be made up of information from the corresponding record in
Table1.
If the application is shutdown and additional records are added to Table1,
the next time the application is run, I want to add extra records to Table2
from these "new" records; preferbly by not completely re-writing Table2 i.e.
appending new records to its end.
Obviously, the application will need to able to "know" which are the new
records.
Can anybody help with this? Some example code would be most appreciated.
Thanks in advance
Geoff 4 879
Geoff,
In my opinion is the most simple to use a boolean in table1
Than you read the table 1 where notmadetable2 = false.
You have to update table 1 than of course as well.
Probably is this not possible for you, however I start with the most simple
solution.
Cor
Geoff,
Is it a SQL database? If not you may be able to modify the statement below
to work for whatever database. I assume there is a key that links Table1 to
Table2, if so you could run some SQL as below.
Hope it helps.
Chris.
INSERT INTO Table2
(T2_Key
, T2_Field_1
, T2_Field_2
, T2_Field_3)
SELECT T1_Key
, T1_Field_1
, T1_Field_2
, T1_Field_3
FROM Table1
LEFT JOIN Table2 ON T2_Key = T1_Key
WHERE T2_Key IS NULL
"Geoff Jones" wrote: Hiya
I have a problem which I'm working on which I hope someone can help with. I have two tables in a database. For the sake of argument, let us call them Table1 and Table2.
For each record in Table1, I want to write a record in Table2 where the record will be made up of information from the corresponding record in Table1.
If the application is shutdown and additional records are added to Table1, the next time the application is run, I want to add extra records to Table2 from these "new" records; preferbly by not completely re-writing Table2 i.e. appending new records to its end.
Obviously, the application will need to able to "know" which are the new records.
Can anybody help with this? Some example code would be most appreciated.
Thanks in advance
Geoff
Thanks Cris and Cor. Most useful suggestions.
Geoff
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com... Geoff,
Is it a SQL database? If not you may be able to modify the statement below to work for whatever database. I assume there is a key that links Table1 to Table2, if so you could run some SQL as below.
Hope it helps. Chris.
INSERT INTO Table2 (T2_Key , T2_Field_1 , T2_Field_2 , T2_Field_3) SELECT T1_Key , T1_Field_1 , T1_Field_2 , T1_Field_3 FROM Table1 LEFT JOIN Table2 ON T2_Key = T1_Key WHERE T2_Key IS NULL
"Geoff Jones" wrote:
Hiya
I have a problem which I'm working on which I hope someone can help with. I have two tables in a database. For the sake of argument, let us call them Table1 and Table2.
For each record in Table1, I want to write a record in Table2 where the record will be made up of information from the corresponding record in Table1.
If the application is shutdown and additional records are added to Table1, the next time the application is run, I want to add extra records to Table2 from these "new" records; preferbly by not completely re-writing Table2 i.e. appending new records to its end.
Obviously, the application will need to able to "know" which are the new records.
Can anybody help with this? Some example code would be most appreciated.
Thanks in advance
Geoff
Following on from Chris's answer, if you are working with a SQL Server
database, then perhaps it would be worthwhile writing a trigger to let the
database automatically replicate the data to the second table.
--
Pete Wright
Author of ADO.NET Novice to Pro for Apress www.petewright.org
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com... Geoff,
Is it a SQL database? If not you may be able to modify the statement below to work for whatever database. I assume there is a key that links Table1 to Table2, if so you could run some SQL as below.
Hope it helps. Chris.
INSERT INTO Table2 (T2_Key , T2_Field_1 , T2_Field_2 , T2_Field_3) SELECT T1_Key , T1_Field_1 , T1_Field_2 , T1_Field_3 FROM Table1 LEFT JOIN Table2 ON T2_Key = T1_Key WHERE T2_Key IS NULL
"Geoff Jones" wrote:
Hiya
I have a problem which I'm working on which I hope someone can help with. I have two tables in a database. For the sake of argument, let us call them Table1 and Table2.
For each record in Table1, I want to write a record in Table2 where the record will be made up of information from the corresponding record in Table1.
If the application is shutdown and additional records are added to Table1, the next time the application is run, I want to add extra records to Table2 from these "new" records; preferbly by not completely re-writing Table2 i.e. appending new records to its end.
Obviously, the application will need to able to "know" which are the new records.
Can anybody help with this? Some example code would be most appreciated.
Thanks in advance
Geoff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mariusz Jedrzejewski |
last post by:
Hi,
I'll be very grateful if somebody can explain me why my Opera 7.23
(runing under linux) doesn't show me inner tables. Using below code I
can see only "inner table 1". There is no problem with...
|
by: Random Person |
last post by:
Does anyone know how to use VBA to relink tables between two MS Access
databases? We have two databases, one with VBA code and the other with
data tables. The tables are referenced by linked...
|
by: dskillingstad |
last post by:
I've been struggling with this problem for some time and have tried
multiple solutions with no luck.
Let me start with, I'm a novice at Access and I'm not looking for
someones help to design my...
|
by: Jill Elaine |
last post by:
I am building an Access 2002 frontend with linked tables to an
encrypted Paradox 7 database. When I first create these linked tables,
I'm asked for the password to the encrypted Paradox database,...
|
by: Shelby |
last post by:
Problem: My company generates its own data export from a propietary
database. These (free) tables can be read in C#.NET using a Visual FoxPro
driver (vfpoledb). I can read each of the six tables...
|
by: phil-news-nospam |
last post by:
In followups by Brian O'Connor (ironcorona) to other posts, he repeats
the idea that using tables in CSS is not something that should be done
because IE doesn't support it. Of course I'm not happy...
|
by: rdemyan via AccessMonster.com |
last post by:
I have a need to add another field to all of my tables (over 150). Not data,
but an actual field.
Can I code this somehow. So the code presumabley would loop through all the
tables, open each...
|
by: db2admin |
last post by:
Hello,
I want to plan rearranging tables in our database according to
business areas. say all tables in business area A will be in seperate
tablespace or tablespaces. I am planning to monitor...
|
by: bubbles |
last post by:
Using Access 2003 front-end, with SQL Server 2005 backend.
I need to make the front-end application automatically refresh the
linked
SQL Server tables.
New tables will be added dynamically in...
|
by: shriil |
last post by:
Hi
I have this database that calculates and stores the incentive amount
earned by employees of a particular department. Each record is
entered
by entering the Date, Shift (morn, eve, or night)...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |