[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

question about best practice of Update query on MS Access local table and SQL serever linked table..

Posted on 2009-02-18
3
Medium Priority
?
186 Views
Last Modified: 2013-11-17
We have update queries in the system designed using the query grid,
where the data from a local MS Access table is set to update it to the sqlserver linked table.
I am curious to know which would be the best method

a) whether to use join in the update query like below and not having the where clause since join is already set on the ids belonging to both tables

UPDATE [Children-local] INNER JOIN Children ON [Children-local].childid = Children.childid SET Children.firstname = [Children-local].firstname, Children.middlename = [children-local].middlename, Children.lastname = [children-local].lastname;

2) Or to use the update query without setting the joins but specify the where clause criteria
like below
UPDATE Children, [Children-local] SET Children.firstname = [Children-local].firstname, Children.middlename = [children-local].middlename, Children.lastname = [children-local].lastname
WHERE (((Children.childid)=[children-local].[childid]));


Would the peformance matter if you are using join vs where clause and which is the best method.

0
Comment
Question by:Jsara
  • 2
3 Comments
 
LVL 85
ID: 23671420
From a performance perspective, there is probably no difference. The query parser will determine the execution plan used, and in the case of identical queries - with the exception of Joins vs Where - the server will almost certainly use the same execution plan for both.

So it comes down to a matter of syntax preference. Many people have difficulties deciphering Join clauses (myself included), and prefer the Where approach ...
0
 

Author Comment

by:Jsara
ID: 23681865
Is it true that using the joins the query needs to process more - to make sure and check the related
records from two sides hence it takes longer as supposed to just using a where clause.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 23682022
No. As I indicated earlier, the server will build an "execution plan" based on the tables, fields, indexes etc etc ... in the case of otherwise identical queries, except one uses Joins while the other uses Where, the server will almost certainly generate the same execution plan, which means that the server will do exactly the same thing. Of course, there is no guarantee of this.

That said, there are opposing schools of thought on this. Some firmly believe you should use Joins at all times, others think that Joins are resource intensive, etc etc ... if you search for this topic, you'll find intense debates and rhetoric on both sides of the battle.

There is a definite art to building good queries, and the only way to determine if a query is better off with a Where clause or a Join (if at all) is to build it both ways and then time both.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question