March 15, 2004 at 10:06 am
Hi guys,
I have a SELECT Query (with sub-query) , that causes the the above error:
SELECT ax.AccNo,
(SELECT Accounts.ProductCode FROM Accounts WHERE h.ID=Accounts.ID) As Product
FROM dbo.History h LEFT OUTER JOIN dbo.AccXRef ax ON h.ID= ax.ID LEFT OUTER JOIN dbo.States ON h.[HistoryItemsub-Type] = dbo.States.Type LEFT OUTER JOIN dbo.CustXRef cx ON h.CustomerNo = cx.CustomerNo
WHERE HistoryItemDate <= getdate() ORDER BY HistoryItemDate ASC
This query runs fine in "Query Analyser" and in the program "A.exe" ...
When a user runs the A.exe he gets the error.
is there a settings in SQLserver that needs to be set???
The connection is made thru ADO, SQL2K...
Many thanx
TNT
March 16, 2004 at 7:33 am
I believe the problem is with your subSELECT:
SELECT Accounts.ProductCode FROM Accounts WHERE h.ID=Accounts.ID
h is never defined within the subSELECT.
-SQLBill
March 16, 2004 at 7:42 am
Hi SQLBill, the query works in query analyer and in the program (A.exe) here.. But the A.exe program does not work for clients ... but am not sure if this occurs for 'SELECT' statement ...
help!!! TNT |
March 16, 2004 at 11:48 am
Does the user have SELECT access to HISTORY?
-SQLBill
March 17, 2004 at 3:08 am
yes. the user has comlete access the whole database. TNT |
March 17, 2004 at 9:55 am
Where does the 'work' take place? I know in Crystal Reports the default is to pull all the data back to the client machine. You can change it to do all the work on the SQL Server machine.
Maybe the queries are being done a bit at a time. Have you tried changing the subquery to use history instead of the h?
-SQLBill
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply