Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

query a joined local table with a linked dbo.sql.table

Posted on 2013-01-27
13
380 Views
Last Modified: 2013-03-19
I have an Access 2010 accdb file which contain a local table.
I have also link this accdb file with a table resident in a SQL server, by using ODBC connection.
I have built sub-queries from a queries based on the local table with a dbo.table located on a server in the SQL.
Whenever running the sub-queries based on the queries as i mentioned , Access takes a long time to process the result.
I have heard that in order to speed up the result of the query I need to build a PASS-THROUGH query.
My problem is that I can`t connect or build any table in the sql server.
I must have local-table in the accdb + linked table from SQL i having both joined to manipulate data from both by using queries.
All queries built up, I did by using a DESIGN VIEW in Access 2010 . Without any VBA code of the DAO or ADO or PASS-THROUGH or SQL VIEW.
Please help, I think it's an interesting challenge:}}
0
Comment
Question by:drtopserv
  • 6
  • 3
  • 2
  • +1
13 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 38824842
Will you be trying to update/edit the linked SQL table?

If not: What I have done is to make a (temp) table in the Access DB using the minimal fields/records from the linked table. No guarantee the make-table query will be quick, but subsequent queries ought to be quicker.
0
 
LVL 42

Expert Comment

by:EugeneZ
ID: 38825117
<problem is that I can`t connect or build any table in the sql server.>

as temp solution , as per above post use stage table in access
as per solution find your DBA and ask to assist you on sql server site

for speed - you may need to set there indexes (sql server) , maybe even use stored procedures
0
 
LVL 16

Accepted Solution

by:
kmslogic earned 500 total points
ID: 38825239
It's difficult to see where the problem from just a description.  The actual SQL from the queries would be useful as well as some information about the # of records, structure and indexes of the tables involved.

I think the suggestion to make a temp file is certainly a possibility.  

This may be a pipeline issue where you're causing the SQL server to dump essentially the entire table over your network pipe in order to do its queries--so you may want to see if there's some tweaking you can do to reduce the data coming over the wire to the bare minimum.  

Also using a snapshot query type for the sub queries (which will make the resulting query read-only) may help things.

Lastly you'll want to make sure you have appropriate indexes on both your local tables and the linked tables on SQL server you're using in your query.  If you see a column in the where clause there's a pretty good chance you'll want an index on that column.
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:drtopserv
ID: 38825482
thanks all for the answer, but still can`t get solution from it.
there is no update in the queries, i`m talking about only manipulate data.
I do not have the ability to do any creation or access to sql server for many reasons.
production server that i shouldn`t touch from my side . i have hardly access the view tables in there to do the query, my local table data i have is from importing xls file to it every day. and i need to do query to the remote sql server table to get some fields and row from there.
0
 

Author Comment

by:drtopserv
ID: 38825484
doesn`t pass-through query help me out, may i use pass-through query to link local table with the sql remote table, is it possible, if yes then how can i do it .
does using vba code will help more than using the design view...?\
i hope that i can found suitable solution :}
0
 
LVL 16

Expert Comment

by:kmslogic
ID: 38825493
No you can't use pass through to create a linked table.  You can create a separate pass through query to access the SQL table directly without a linked table. however I cannot think of a situation where this would make your queries run faster.
0
 

Author Comment

by:drtopserv
ID: 38825527
I think there  must be solution around :{{{{
need to seek , thanks for your answer anyway:}
0
 
LVL 42

Expert Comment

by:EugeneZ
ID: 38825547
< i need to do query to the remote sql server table to get some fields and row from there. >
yes, you  need to do query to the remote sql server table to get some fields and row from there.

work with your DBAs team to have it
and for now staging table needs to be considered
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38825559
Drtopserv,
We have offered some solutions to possibly make your queries work faster.
a. Do a make-table query off of your linked table,
as in 'Select * into tempTable from yourLinkedTable'.
b. Better still, if table size is an issue:
'Select field1, field2, field4, etc into tempTable from yourLinkedTable'

c. or better, if there are criteria:

'Select field1, field2, field4, etc into tempTable from yourLinkedTable
where somefield = LocalTable.fieldInLocalTable'

tempTable being a staging table as mentioned by EugeneZ
0
 

Author Comment

by:drtopserv
ID: 38825567
Ok, the linked table you mean is the local table or the sql one.
if you are talking about the table resident in sql , then it`s not a good solution.
it`s very big table! .
0
 

Author Comment

by:drtopserv
ID: 38825569
Oh sorry i can see you mean the sql-server-table as linked table :{
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38825576
Yes.
 kmslogic (ID: 38825239) stated good points which were missing from simple suggestions.

Especially: Size of linked table, interms of record count, table structure
SQL, meaning specific fields needed from linked table
Tweaking to reduce amount of data needing to go to access
0
 

Author Closing Comment

by:drtopserv
ID: 38998270
thnx i`ll go for your suggestion
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

856 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