Error Message - Help Needed

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Amy (Amy_at_discussions.microsoft.com)
Date: 07/22/04


Date: Thu, 22 Jul 2004 08:19:58 -0700

Hi all

I'm trying to use a sql statement in an asp page. I have 2 separate statements that work, but I'm trying to UNION them.

When I run this query in the web page I get the following error. Not exactly helpful since it doesn't tell me WHAT it want.

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ';'.
/management/bi/newtest4.asp, line 393

My query IS line 393 and this is what it is:

SELECT Sum(SumOfSDAEXP)
FROM (Select Sum(proddta.F554211B.SDAEXP) AS SumOfSDAEXP
FROM proddta.F554211B
WHERE proddta.F554211B.SDEMCU LIKE '%DEN'
UNION ALL
Select Sum(proddta.F554211A.SDAEXP) AS SumOfSDAEXP
FROM proddta.F554211A
WHERE proddta.F554211A.SDEMCU LIKE '%DEN');

The tables that end in A are doing current sales, the table that ends in B is doing historical sales, both have EXACTLY the same column names.

Any ideas on what the syntax error is??

THanks



Relevant Pages

  • Re: Error Message - Help Needed
    ... FROM AS SumOfSDAEXP ... WHERE proddta.F554211A.SDEMCU LIKE '%DEN') AS x; -- Added alias to this line ... but I'm trying to UNION them. ... is doing historical sales, both have EXACTLY the same column names. ...
    (microsoft.public.sqlserver.programming)
  • Re: UNION of two SELECT extremely slow
    ... I've localized the problem and it is about UNION operation. ... Another way to help the SQL statement is to remove the subquery, ... The inline view only needs to be resolved once, ... VW.SUPERCATEGORY_ID AS PARENTID, ...
    (comp.databases.oracle.misc)
  • Re: Querying a dataset
    ... > Rep, Area, Period, Qty. ... > I want to display this data on a datagrid like: ... just glancing at your sql statement. ... > UNION ALL ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Error Message - Help Needed
    ... but I'm trying to UNION them. ... > When I run this query in the web page I get the following error. ... exactly helpful since it doesn't tell me WHAT it want. ... is doing historical sales, both have EXACTLY the same column names. ...
    (microsoft.public.sqlserver.programming)
  • Re: Union view limits
    ... Art Kagel wrote: ... single SQL statement which is 65535 characters, so if each table and column name is two characters long that works out to about 3449 SELECTS in an maximum length UNION less the characters needed to define the VIEW. ... Suppose you approach this 65K limit on the length of SQL statement in your CREATE UNION command. ...
    (comp.databases.informix)