update only changed rows

  • Thread starter Thread starter JIM.H.
  • Start date Start date
J

JIM.H.

Hello,
I have table1 and tabel2 and I need to make table2 match
table1 whenever something changed in table1. I can delete
all records in table2 and add all records from table1 to
table2, is there any way to update only mismatch records?
Thanks,
Jim.
 
Jim,

If you need table2 to be an exact replica of table1 why
not link table1 to table2 (assuming they are in different
databases), or just use 1 table if they are in the same db?

HTH
 
Thanks for the reply. table1 is an excel file link to
Access 2002 mdb, table2 is a SQL table link to the same
Access 2002 mdb through an ODBC. can I link excel to an
SQL database?
 
Why not?

Following is an extract from sp_addlinkedserver procedure
description:

F. Use the Microsoft OLE DB Provider for Jet on an Excel
Spreadsheet
To create a linked server definition using the Microsoft
OLE DB Provider for Jet to access an Excel spreadsheet,
first create a named range in Excel specifying the columns
and rows of the Excel worksheet to select. The name of the
range can then be referenced as a table name in a
distributed query.

EXEC sp_addlinkedserver 'ExcelSource',
'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'c:\MyData\DistExcl.xls',
NULL,
'Excel 5.0'
GO

In order to access data from an Excel spreadsheet,
associate a range of cells with a name. A given named
range can be accessed by using the name of the range as
the table name. The following query can be used to access
a named range called SalesData using the linked server set
up as above.

SELECT *
FROM EXCEL...SalesData

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top