473,725 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looping Query Defs

Can you loop through Query Defs and get the name of the tables/queries used
in each query?


Nov 13 '05 #1
3 3596
with a bit of parsing you can. you'd basically do something like this:
1. grab all the text between FROM and WHERE. Use Split to break that
into separate words that you can deal with one at a time. loop through
them, and eliminate all SQL reserved words. Then you should be left
with what you want.

Nov 13 '05 #2
something along the lines of

dim qdf as querydef
for each qdf in db.querydefs
varWords = Split(qdf.SQL," ")
for intCounter = 0 to Ubound(varWords )
If Not IsObjectName(va rWords(intCount er)
' write it somewhere?
rs.AddNew
rs.FIelds("Some Field")=varWord s(intCounter)
rs.Fields('obje ctname")=qdf.Na me
rs.update
End if
next intCounter
next qdf

Nov 13 '05 #3
Thanks
<pi********@hot mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
something along the lines of

dim qdf as querydef
for each qdf in db.querydefs
varWords = Split(qdf.SQL," ")
for intCounter = 0 to Ubound(varWords )
If Not IsObjectName(va rWords(intCount er)
' write it somewhere?
rs.AddNew
rs.FIelds("Some Field")=varWord s(intCounter)
rs.Fields('obje ctname")=qdf.Na me
rs.update
End if
next intCounter
next qdf

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4060
by: kaptain kernel | last post by:
i've got a while loop thats iterating through a text file and pumping the contents into a database. the file is quite large (over 150mb). the looping causes my CPU load to race up to 100 per cent. Even if i remove the mysql insert query and just loop through the file , it still hits 100 per cent CPU. This has the knock on effect of slowing my script down so that mysql inserts are occuring every 1/2 second or so.
3
5372
by: Edward | last post by:
I am having conceptual trouble with the following query: select r.ServiceID,r.ContractID,sum(Total) from ( select csc.ServiceID,c.ContractID, sum(csc.ContainerMovement) as Total from iwms_tbl_CustomerSiteContainers csc, iwms_tbl_ContractLines cl, iwms_tbl_Contracts c,
9
2765
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with each having 3 fields each, their own PK; the FK back to the parent table; and the unique data for that table. There is a one to many relation between the parent and each of the 9 child rows. Each child table has between 100,000 and 300,000
8
2095
by: RC | last post by:
I have a table that lists many box numbers. Each box number has a Pallet Number (indicating which pallet the box is in). When the Pallets are loaded into a shipping Container I need to update the table to indicate which pallets and boxes are in the container. In my code below, in the table named "Products", I find the first Pallet Number that matches the Pallet Number typed in the box on my form (PalletNumberContainerFormComboBox)....
2
1844
by: G Patel | last post by:
aan anyone tell me what a .defs and .s file extensions are in a C program (folder)? thanks a lot
20
3056
by: Stewart Graefner | last post by:
Here is a chunk of code that works for an individual record. It evaluates dates and checks or unchecks boxes as it goes along. It may not be pretty but it works. What my problem is that I need it to evaluate all the records(200+) in my db and change those which need changing. Having to do it individually would defeat the purpose of developing this code. What I would like to be able to do is either 1. Open the db push a button and all the...
2
1582
by: Delores | last post by:
I have been running make-table queries to create 10 tables (one for each unit) that are exported to Excel spreadsheets. Because of my limited knowledge with code, I've created 10 separate queries to do the job and then run a macro to do the exporting. I know there must be a way to generate the 10 tables with only one query and I think it probably involves looping(?) through the query. I've read the previous postings and anytime I try to...
5
1927
by: talktozee | last post by:
Hello, everyone! Here's are the basics: 1. The query looks at all positions that are active and haven't been filled. 2. It then has to look at every single position and determine three things: Does the person running the query (via an ASP page) have certain rights? a. Recruit rights b. Enlist rights c. Take rights
1
1508
by: mike_dba | last post by:
I am trying to determine which tables in my database are being joined and by what columns. I then came up with a query against EXPLAIN_PREDICATE that returns rows similar to the following: (Q1.PERIOD_KEY = Q2.PERIOD_KEY) My problem is tying this Q1 & Q2 back to a tablename? Does anyone know how this may be done? Or perhaps a suggestion on how better to obtain this information.
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.