Solved

Need help writing a Pass Through Query in A2K

Posted on 2014-11-30
9
74 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 47

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
 

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 47

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 47

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

832 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