Solved

Union All Error

Posted on 2012-04-10
3
200 Views
Last Modified: 2012-04-10
The stored procedure that I attached was running fine until I added the last two queries to the CT section. The addition in for Bell Nursery. When I add the queries I get “Incorrect Syntax near the keyword ‘Union’ “, when I try to compile the SP.

The only way to get read of the error in to comment ( as I did ) the new addition.

Is there a limit on the number of Unions I can use in a SP?
Union-Problem.sql
0
Comment
Question by:GadFriedman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Simone B earned 500 total points
ID: 37828511
You need to remove the "order by" clause from the previous select:

order by bill_id,year,month

--/*

Union all

----------------------------------------------------------------------------

--Bell Nursery
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 37828517
Hi,

Just remove order by or move it to last section


--order by bill_id,year,month

Thanks
0
 
LVL 11

Expert Comment

by:Simone B
ID: 37828524
Move it to the end of the last select.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question