Error Message - Help Needed

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: Import .csv question
    ... I found that the SQL statement that you ... > UNION ... > Sub ImportOneFile(FileSpec As String) ... > Dim strFolder As String ...
    (microsoft.public.access.externaldata)