Solved

Union All Error

Posted on 2012-04-10
3
196 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now