Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT fails if TOP 10 added to query 1

Status
Not open for further replies.

oldboy

Programmer
May 28, 2003
3
GB
If I simply use
SELECT * FROM WBS_TRANSACTIONS
the resultset opens but as there are several thousand records it takes sometime. So as all I want to do is add a new record I tried the following
SELECT TOP 10 * FROM WBS_TRANSACTIONS ORDER BY CONTRACT_NO DESC
This produces an Error 40002 "S0022. Column not Found". If a column is missing surely the overall select would fail as well. The error occurs as well for TOP 1 and TOP 3.
Help would be appreciated as I want to eliminate the delay in loading.
 
Mine works fine when I use field names instead of the wildcard (asterisk), although it seems both should do the job, i.e. SELECT TOP 10 FLD1, FLD2, FLD3
FROM tablename ORDER BY FLD1 DESC. If there aren't too many fields, or you only need certain values, this may work. Otherwise you may have misspelled the column name in the SQL (like maybe CONTRACT_NUM instead of CONTRACT_NO)?
-Geno
 
Thanks for suggestion but CONTRACT_NO is correct and even replacing * with field names does not work.
I have got round the problem by changing the select clause to SELECT * FROM WBS_TRANSACTIONS WHERE THIS_RECORD = 1. This removes the delay.
I wonder if it is something to do with Sage's ODBC driver.
 
That is probably a good guess. I'm using SQL Server 2000 linked to Access 2000. If you just want to copy the data (load?) to a backend table, INSERT INTO may be a faster route as well. Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top