You are here: SQL query timeout « MsSQL Server « IT news, forums, messages
SQL query timeout

Posted by RodStrongo1 on 01/14/08 21:36

I am looking for some help troubleshooting my SQL issue.
I have taken over someone else's work, and am now playing catch up.

I have an MS SQL db holding distributor information for my client,
consisting of domestic and intl distributors.
From an asp page, the user is prompted to input their country.
When a domestic location is chosen, things work smoothly.
When an international location is chosen, the asp eventually times out
and returns an ASP 0113 error.

For several months, the international side worked fine. Using my
development db, things work fine.
This makes me think something inconsistent could have entered the
(prod) data and is causing it to spin.

This query should return a list of 1 or more distributors matching a
locale. It now returns one match, and subsequent entries are replaced
with the ASP 0113 error.


sql = "select arrDist_id_physical from country_codes where
intCountry_code='"&sqlencode(intCountry_Code)&"'"
response.write(debugSql(sql))
......

sql = ""
sql = sql&"select "
sql = sql& "LEFT(distributors_detail.cust_no, CHARINDEX('-',
distributors_detail.cust_no) - 1) AS distributorNumber, "
sql = sql& "* "
sql = sql&"FROM "
sql = sql& "distributors_detail "
sql = sql&"where "
sql = sql& "right(distributors_detail.cust_no,
len(distributors_detail.cust_no) - (charindex('-',
distributors_detail.cust_no) - 1)) in('-0','-1','-X','-A', '-W') AND "
sql = sql& "isNull(cust_code_3,'') in('', 'CH') AND "
sql = sql & " or LEFT(cust_no, CHARINDEX('-', cust_no) - 1) =
'"& trim(arrDist_id_physical(iIntern)) &"'"
sql = sql& "LEFT(distributors_detail.cust_no, CHARINDEX('-',
distributors_detail.cust_no) - 1) IN ("
for iIntern = 0 to ubound(arrDist_id_physical)
if iIntern = 0 then
sql = sql&"'"&trim(arrDist_id_physical(iIntern))&"'"
else
sql = sql&",'"&trim(arrDist_id_physical(iIntern))&"'"
end if
next
sql=sql&") AND "
sql = sql& "isNull(cust_code_2,'') = '' "
sql = sql&"ORDER BY "
sql = sql& "cust_no ASC"


The web/SQL server is a 2000 server, running dual xeons.

Any guidance in this issue would be greatly appreciated. If I am
omitting pertinent info, please just inform.

THANK YOU!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация