SteveL13
asked on
Append or Update Query
I want to run a query that updates a record I a table if the record already exists. But if the record does not exist I want it to create a new record in the table.
The source table is "Source". The destination table is "Destination"
The both have a key field named "RecordID"
If I just try to run an update query it fails because the record isn't there. But if I run an append query it works fine if the record is already there.
Confused!!
--Steve
The source table is "Source". The destination table is "Destination"
The both have a key field named "RecordID"
If I just try to run an update query it fails because the record isn't there. But if I run an append query it works fine if the record is already there.
Confused!!
--Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Some people call this an UPSERT query. In SQL Server, they have a similar query syntax called MERGE which gives you the ability to Update and Append at the same time, and you can even get a count of how many of each action are completed.