473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 3542
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(varWords(intCounter)
' write it somewhere?
rs.AddNew
rs.FIelds("SomeField")=varWords(intCounter)
rs.Fields('objectname")=qdf.Name
rs.update
End if
next intCounter
next qdf

Nov 13 '05 #3
Thanks
<pi********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.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(varWords(intCounter)
' write it somewhere?
rs.AddNew
rs.FIelds("SomeField")=varWords(intCounter)
rs.Fields('objectname")=qdf.Name
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
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...
3
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...
9
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...
8
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...
2
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
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...
2
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...
5
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...
1
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: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.