Solved

Need help writing a Pass Through Query in A2K

Posted on 2014-11-30
9
69 Views
Last Modified: 2015-02-15
Hello,

I'm running an application written in Access 2K.
It has a split front/back end.

My InternetData table is on a MS SQL server
My Parts4Sales and ComponentMaster tables are Access mdb files.

The following query appends about 250,000 records and takes about 20 minutes to run.  I need to speed it up.
I've been told I need to create a stored procedure or a pass through query.

First question, is this possible in as only one of the tables is on the MS SQL server
Second, if yes, will I get better performance out of the stored procedure or pass through?
Third, how can I find out how the SQL table is connected to the database.  I set it up myself, but it was years ago.
0
Comment
Question by:pcalabria
  • 5
  • 3
9 Comments
 
LVL 24

Expert Comment

by:chaau
ID: 40473008
I think you have forgotten to attach the query.
1. It depends what you need to pass to the stored procedure as parameters. If you need to pass just values then it is possible to use The stored procedures. However, if your append query appends data directly from a SELECT statement from an Access table, I do not think you will get much performance improvements. As I said before, please show us your existing query, which indirectly answers your second question
3. You can find this information simply by looking at the "Linked table Manager". In Access 2000 this option is under Tools->Database Utilities->Linked Table Manager
0
 

Author Comment

by:pcalabria
ID: 40473019
opps... here we go:

INSERT INTO InternetData ( OriginCode, LotCode, DateCodeAll, PartID, HouseNumber, ProjectHouseNumber, TrackingNumber, Description, PartClass, PartFamily, PartMarking, GenericNumber, Package, RecPrice, FullPacks, TrayQty, DocName, code, PackageQty, PackageType, Condition, ConditionCategory, PbookPrice, quantity, Manufacturer, SalesNote, Notes, LineID, [Value], Tolerance, FullReelQty, ReelSize, TapePitch, TapeWidth, CaseSize, TCR, Power, Voltage, OperatingRange, MSL, EURoHS, Pb, SearchNumber, OrderNumber ) SELECT Parts4Sales.OriginCode, Parts4Sales.Lotcode, Parts4Sales.DateCodeAll, Parts4Sales.PartID, Parts4Sales.HouseNumber, Parts4Sales.ProjectHouseNumber, Parts4Sales.TrackingNumber, ComponentMaster.Description, ComponentMaster.PartClass, ComponentMaster.PartFamily, ComponentMaster.PartMarking, ComponentMaster.GenericNumber, ComponentMaster.Package, Parts4Sales.RecPrice, Parts4Sales.FullPacks, Parts4Sales.TrayQty, ComponentMaster.DocName, ComponentMaster.code, Parts4Sales.PackageQTY, Parts4Sales.PackageType,
Parts4Sales.Condition, Parts4Sales.ConditionCategory, ComponentMaster.PBookPrice, Parts4Sales.Quantity, ManufacturerMaster.ShortName AS Manufacturer, Parts4Sales.SalesNote, ComponentMaster.Notes, Parts4Sales.LineID, ComponentMaster.Value, ComponentMaster.Tolerance, ComponentMaster.FullReelQty, ComponentMaster.ReelSize, ComponentMaster.TapePitch, ComponentMaster.TapeWidth, ComponentMaster.CaseSize, ComponentMaster.TCR, ComponentMaster.Power, ComponentMaster.Voltage, ComponentMaster.OperatingRange, ComponentMaster.MSL , ComponentMaster.EURoHs, ComponentMaster.Pb, Parts4Sales.searchNumber, ComponentMaster.OrderNumber FROM (Parts4Sales LEFT JOIN ComponentMaster ON (Parts4Sales.LineID = ComponentMaster.LineID) AND (Parts4Sales.SearchNumber = ComponentMaster.SearchNumber)) INNER JOIN ManufacturerMaster ON Parts4Sales.LineID = ManufacturerMaster.LineID WHERE (((Parts4Sales.SearchNumber) Is Not Null And (Parts4Sales.SearchNumber)<>''));
0
 

Author Comment

by:pcalabria
ID: 40473105
So the question is, is there a way I can speed up the above query.  When running as an Access query, it takes about 20 minutes to run with 250,000 records.
0
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40473294
All tables are in SQL Server? If not, which ones are and which ones not?
There's an index on Parts4Sales.SearchNumber? If not, you should create one for this query.
There's an index on ComponentMaster.SearchNumber? If not, you should create one for this query.
0
[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

 

Author Comment

by:pcalabria
ID: 40473475
<<InternetData table is on a MS SQL server>>
<< Parts4Sales and ComponentMaster tables are Access mdb files.>>

The query is run from the an Access 2K front end, off an XP Pro workstation.
Both mdb files are on a Windows 2000 Server
The InternetData table is on a different workstations which is running MS Server 2008 ( I think its R2, its a paid version)

LineID in all tables is numeric, and it is indexed
Searchnumber in all tables is string, and it is also indexed

There are about 250,000 records in the query
When I convert to a select query and run it in the query builder I see results in about 3 seconds.  When I then hit end to see the last record it takes about 30 seconds.

One of the other experts suggested I use a stored procedure or pass through, but I don't know how to do that so have not tried.  It would think that since all the data is not on the SQL server, it may be complicated.

If anyone can help it would be greatly appreciated.   I'm trying to get this working before the staff arrives at work in another hour! :-(
0
 
LVL 46

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40473490
When I convert to a select query and run it in the query builder I see results in about 3 seconds.  When I then hit end to see the last record it takes about 30 seconds.
That's because Access only shows you part of the information. If you go to the last record he needs to load all data and that's why takes longer.

One of the other experts suggested I use a stored procedure or pass through, but I don't know how to do that so have not tried.  It would think that since all the data is not on the SQL server, it may be complicated.
Impossible I may say since there's no stored procedures in MS Access.
0
 

Author Comment

by:pcalabria
ID: 40473990
Thanks for the comments.

I mention that the select query can display all of the records in 30 seconds because it seems odd that I can pull 250,000 records in 30 seconds from Access MDB tables, but when I change the query to an APPEND query and append the same data to an MS-SQL server, it takes 20 minutes.

Doesn't  that seem strange to you?

Anyone that can help, please chime in!  Thanks Victor and Chaau.
0
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40475380
I don't work with Access for long. What do you mean with APPEND? It's a SELECT INTO?
0
 

Author Closing Comment

by:pcalabria
ID: 40610740
Thanks
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now