[thelist] Effcient ASP Script?

Paul Roub paul at roub.net
Mon Nov 25 15:04:01 CST 2002

I would also update all-at-once, or at least many-at-once.

So build a comma-separated list of matching companies as you go:

	if (strCompanies <> "") then
		strCompanies = strCompanies & ","
	end if

	strCompanies = strCompanies & "'" & rstemp("company") & "'"

then, when all is said and done,

	conn.execute("update registrants set type=1 where company in (" &
strCompanies & ")"

Yes, this will be an enormous statement (you may want to break it up into
smaller chunks to avoid SQL Server limitations -- I don't have docs handy to
say whether there *are* any here), but many round-trips go away.

Of course, my *real* first question would be -- why are you doing this?  Is
there a better approach to whatever your'e trying to accomplish?


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Chris Blessing
Sent: Monday, November 25, 2002 3:55 PM
To: thelist at lists.evolt.org
Subject: RE: [thelist] Effcient ASP Script?


What is the DBMS behind this? SQL Server?

If so, you can use the TOP clause to get just the first 2000 records,
significantly reducing your recordset overhead.


SELECT TOP 10 field1, field2 FROM myTable

Also, define the fields you want to select in your query, rather than
selecting *.

Chris Blessing
webguy at mail.rit.edu

> Hi folks!
> I am writing a page that selects all records with company names and then
> updates the type of those records if they are the first 2000 records.  The
> database has a total of 13,000 records.  When I run this on my server, it
> takes a long time, and then times out.
> My 1st questions is, how can I keep any script in general from timing out?
> My 2nd question is - is my code efficient?  I wouldn't think that it would
> take so long for this process to run, but it only gets through about 1400
> records before the timeout happens.
> Any help is appreciated!
> Thanks,
> adam

* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !

More information about the thelist mailing list