Solved

Problem with my Query... Please help.

Posted on 2004-04-05
2
470 Views
Last Modified: 2012-06-27
I am using the following Query in Excel VBA:

QueryBOM = "SELECT [Silver King$BOM Component].[Parent Item No_]," & _
  "[Silver King$BOM Component].[LM Version Code]," & _
  "[Silver King$BOM Component].[Point of Use]," & _
  "[Silver King$BOM Component].[Balloon No_]," & _
  "[Silver King$BOM Component].[No_]," & _
  "[Silver King$BOM Component].[Description]," & _
  "[Silver King$BOM Component].[Quantity per]," & _
  "[Silver King$BOM Component].[Unit of Measure Code]," & _
  "[Silver King$BOM Component].[Type]," & _
  "[Silver King$Item].[No_]," & _
  "[Silver King$Item].[LM Current BOM Version]," & _
  "[Silver King$Item].[LM Item Status]," & _
  "[Silver King$Item].[Description]," & _
  "[Silver King$Item].[Revision Level]," & _
  "[Silver King$Item].[Replenishment System]," & _
  "[Silver King$Item].[Base Unit of Measure]" & _
  "FROM [Silver King$BOM Component],[Silver King$Item] " & _
  "WHERE [Silver King$BOM Component].[No_] = '" & PartNumberChild & "' " & _
  "AND [Silver King$BOM Component].[LM Version Code] = " & _
  "[Silver King$Item].[LM Current BOM Version] " & _
  "ORDER BY [Silver King$BOM Component].[Parent Item No_]," & _
  "[Silver King$BOM Component].[LM Version Code]," & _
  "[Silver King$BOM Component].[Point of Use]," & _
  "[Silver King$BOM Component].[Balloon No_]"

But I guess this error about it runs for about a minute:

Run-time error '-2147467259 (80004005)':
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (WrapperRead()).

In the past I queried one table at a time and then skipped past the data I didn't want, but in an attempt to reduce run-time I wanted to try a join (or adding a compare between fields in each table in the WHERE command).

Any help would be great!

Thanks
0
Comment
Question by:dougshepard
2 Comments
 
LVL 34

Accepted Solution

by:
arbert earned 500 total points
Comment Utility
To make things easier, I would paste the query into Query Analyzer and take a look at it.    See what the query plan looks like and see if Query Analyzer gives any errors.
0
 

Author Comment

by:dougshepard
Comment Utility
Ahhh.  Query Analyzer is part of Enterprise Manager.  Thanks.  

I think I was running out of memory (i.e. bringing in too large of a recordset because of query was incorrect).

Thanks!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Help in Understanding a SQL Query 7 24
Numeric sequence in SQL 14 36
Sql query to Stored Procedure 6 12
sql calculate averages 18 21
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how the fundamental information of how to create a table.

728 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

9 Experts available now in Live!

Get 1:1 Help Now