G'Day,
If we have the following tables:
TblVenues, Import_tblVenues with the following structure:
VenueCode (PRIMARY KEY)
Description
Location
I have a scenario where data is placed into the Import_tblVenues table and I
then want to transfer that information into a production table called
tblVenues. The following SQL places the new records in:
INSERT INTO tblVenues
SELECT VenueCode, Description, Location
FROM Import_tblVenues
WHERE VenueCode NOT IN (SELECT VenueCode FROM tblVenues)
That's easy. However I would like to be able to cope with UPDATES as well.
So say for example we have the following data in Import_tblVenues
AUS, Australia, Australia
and we have the following data in tblVenues
AUS, Aussie, Outback
I would like some SQL that would allow me to detect that the Description,
Location fields are different so that I can log the changes made. I realise
that I could merely do an:
UPDATE tblVenues SET......
Also if at all possible I would like the function to be generic in the sense
that it would apply / work with any table no matter what the structure....
Any ideas, pointers would be greatly appreciated..... I would prefer it if
the SQL was "generic" and did not use any vendor specific enhancements. That
being said the database is SQL Server 2K, so if vendor extensions are
required then they need to be M$'s.....
TIA
-- Donovan
----------------------------------------------------------------------
Donovan J. Edye [www.edye.wattle.id.au]
Namadgi Systems [www.namsys.com.au]
Voice: +61 2 6285-3460
Fax: +61 2 6285-3459
TVisualBasic = Class(None);
Heard just before the 'Big Bang': "...Uh Oh...."
----------------------------------------------------------------------
GXExplorer [http://www.gxexplorer.org] Freeware Windows Explorer
replacement. Also includes freeware delphi windows explorer components.
----------------------------------------------------------------------
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"