Notifications
Clear all

2473237 - Query Does Not Run in Query Generator

1 Posts
1 Users
0 Reactions
328 Views
admin
Posts: 466
Admin
Topic starter
(@admin)
Noble Member
Joined: 3 years ago

Symptom

Error occurs when you run a query from Query Generator. However if you remove some spaces from the query, it works.

Reproducing the issue

Scenario:

  1. Open Query Generator from Tools  Queries.
  2. Click Execute to open the Query Generator window.
  3. Click pencil icon to change it to Edit mode.
  4. Copy the following query and then click Execute:

SELECT (SELECT COUNT(*) FROM WOR1 PL WHERE PL.ItemCode = I.ItemCode) AS 'TEST' 
From OITM I 
WHERE I.UpdateDate <= '[%0]'

Expected behavior:

Query - Selection Criteria window is opened to ask for the UpdateDate value.

Actual behavior:

Error occurs in the status bar:

1). [Microsoft][SQL Server Native Client 11.0][SQL Server]Must specify table to select from. 2). [Microsoft][SQL Server Native Client 11.0][SQL Server]Statement '' (SWEI) (s) could not be prepared.

Workaround:

If you remove the space next to the = sign in the first WHERE clause, then the query works:

SELECT (SELECT COUNT(*) FROM WOR1 PL WHERE PL.ItemCode=I.ItemCode) AS 'TEST' 
From OITM I 
WHERE I.UpdateDate <= '[%0]'

OR

If you remove the second WHERE clause WHERE I.UpdateDate <= '[%0]', then the query still works:

SELECT (SELECT COUNT(*) FROM WOR1 PL WHERE PL.ItemCode = I.ItemCode) AS 'TEST' 
From OITM I

Reply
Share:
x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security