473,804 Members | 3,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL question... batch query...

I have a problem that probably has a simple solution but I don't have
much SQL experience...
My company's database is pretty crummy, based on Access97 .MDB files
with a VB front-end. My company sends updates to our clients every
month via e-mail, over the past 7 years a lot of the addresses have
gone out of use and we get more and more bounce-backs. We are looking
to update our contact database but our old database does not allow us
to search by email address. However, I can query the database for an
address and spit back the info we need.

Anyway, I've taken all of the bounce back emails and wrote a TCL script
to extract the addresses (670 in all) and have them listed (1 addresses
per line) in a text file.

I am using Excell 2003 with Microsoft Query and had TCl generate SQL
code to Query my dB for every address and spit them back. I get the
'Query too complex' error because I have 670 'OR' clauses. I understand
that this is probably not the best way to do this.

Finally, my question is... is there a way to create a SQL loop to
extract a line from a file at a time, query the database for that text,
return what is necessary, then process the next line in the file. I'm
looking to do batch querying on a database, returning a lot of data
based upon roughly 670 individual queries. Possible?

Nov 13 '05 #1
3 2297

Link to the text file.
Join the text file to your query.

No need for the OR statements.

br***@powercare ers.com wrote:
Anyway, I've taken all of the bounce back emails and wrote a TCL script
to extract the addresses (670 in all) and have them listed (1 addresses
per line) in a text file.
I am using Excell 2003 with Microsoft Query and had TCl generate SQL
code to Query my dB for every address and spit them back. I get the
'Query too complex' error because I have 670 'OR' clauses. I understand
that this is probably not the best way to do this.
Finally, my question is... is there a way to create a SQL loop to
extract a line from a file at a time, query the database for that text,
return what is necessary, then process the next line in the file. I'm
looking to do batch querying on a database, returning a lot of data
based upon roughly 670 individual queries. Possible?


Nov 13 '05 #2
Can you show me an example of this? Thank-you

Nov 13 '05 #3
An example of what? The SQL query?

UPDATE [myTable]
INNER JOIN [myTextFile] ON [myTable].[email] = [myTextFile].[email]
SET [myTable].[email] = Null
br***@powercare ers.com wrote:
Can you show me an example of this? Thank-you


Nov 13 '05 #4

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

Similar topics

3
9794
by: Philip Yale | last post by:
A colleague of mine has a query which fails to run under SQLAgent batch with the following error: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. (Error 242) The statement has been terminated. (Error 3621). The step failed. He can run the same query sucessfully via query analyzer (i.e. no errors, and it does what he wants)
1
3037
by: vbnetrookie | last post by:
Hi all, This is my first batch file and I want to query a database and output it in a textfile. Up to now that works, the only problem is the formatting in the text file. It's all screewed up...lines aren't lined up and columns aren't right....how do you format the result from a query to a text file. Here's my code: osql.exe -S MYMACHINE -w 30 -E -d Demo2 -Q "select * from Title where frequency = 'monthly'" -o "C:\output.txt"
5
1233
by: Mark R | last post by:
Hi all, This query is not too specific, I was just curious. An application at work retrieves data from SQL server. One SQL that is used runs 3 at the same time and returns the results together in notepad. Each SQL has it's own header with the results underneath. I have looked at the SQL and as soon as the first finishes, the second starts and so on. All 3 SQL's are querying the same table. I have tried writing a SQL in the same format...
12
5149
by: Selva Chinnasamy | last post by:
Hi I am using batch commands against Ms-Access and getting an error Message "Characters found after end of SQL statement." String Here is my sql Dim str_screens As String = "Select * from Screens Order by ScreenName;Select * from Functions" How can I fix this problem. Any help is greatly appreciated. Selva
1
3766
by: Crash | last post by:
Hi, ..NET v1.x SP1 VS 2003 SQL Server 2000 SP3 Server 2000, XP, Server 2003 I would like to programmatically execute {possibly many} SQL Server batch scripts. Aka I have many scripts that drop/add stored procedure definitions, alter table definitions & constraints, etc... and I would
2
2621
by: eric1025 | last post by:
I have a form with a command button. When the command button is clicked, it runs a batch file via the Shell command. The batch file is run with a few variables coming from the database such as %1 and %2 for different fields, so that a user is added to a group in active directory, and then one of my access database fields (Date_Added) is set to Me!Date_Added = Date. I would like to make this more of a batch type process, where the file...
0
1164
by: LynchB | last post by:
Hi there I have an audit table which sequentially logs all activity against a device. A read operation is made up of a batch of (usually) three audit records thusly: Record 1 - Open Record 2 - Read position xxx Record 3 - Close Similiarly a write operation is made up a batch of three audit records: Record 1 - Open
1
6494
by: mattdoughty | last post by:
Hi, I'd like to return the output, or output as a variable, from a pgSQL query that I'm executing through batch file back to the batch file so that it executes a line in particular of the batch file (through a 'goto' command I think). I manage to execute the query and see the result (in cmd) but am not sure how I can grab that result and use it. If anybody's got any ideas...? Thanks,
2
1348
by: moorcroft | last post by:
I've never really written batch files before and don't know syntax etc so am looking some help. My folder structure is as follows: c:\applications\ contains a list of folders for example: c:\applications\100000\ , c:\applications\200000\ etc and in each of these folders there are lists of folders named by the applications primary key, for example: c:\applications\100000\154523\application_form.pdf...
0
9704
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
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10319
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
10303
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
9132
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...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
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.