• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Union All Error

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
GadFriedman
Asked:
GadFriedman
  • 2
1 Solution
 
Simone BSenior E-Commerce AnalystCommented:
You need to remove the "order by" clause from the previous select:

order by bill_id,year,month

--/*

Union all

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

--Bell Nursery
0
 
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
Hi,

Just remove order by or move it to last section


--order by bill_id,year,month

Thanks
0
 
Simone BSenior E-Commerce AnalystCommented:
Move it to the end of the last select.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now