[thelist] SQL UNION choking on ORDER BY clause
rudy
r937 at interlog.com
Thu May 16 08:29:03 CDT 2002
> the groovy 'Check Syntax' button tells me
> that there's an error near 'ORDER'
hi joel
the groovy Check Syntax button is right
but it's not very smart, it shoulda tole you what the error is
> And, yes, I'm positive there must be a cleaner way to do this.
you're likely right
> I'm wide open for suggestions on general efficiency here.
fly me down for a day or two of consulting?
;o)
here's your procedure, judiciously edited --
CREATE PROCEDURE GetPendingBySupervisorEmpID2
( @SupervisorEmpID int )
AS
IF @SupervisorEmpID = 45
BEGIN
( SELECT stuff )
UNION
( SELECT stuff )
ORDER BY r.po_ID DESC
END
ELSE IF @SupervisorEmpID = 36
BEGIN
( SELECT stuff
UNION
( SELECT stuff )
ORDER BY r.po_ID DESC
END
ELSE
BEGIN
SELECT stuff
ORDER BY r.po_ID DESC
END
do you see where there's a missing parenthesis?
rudy
More information about the thelist
mailing list