[thelist] SQL UNION choking on ORDER BY clause
Joel Canfield
joel at spinhead.com
Thu May 16 08:49:01 CDT 2002
> > 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)
You have my work address, right? I've got a project in the works *right now*
that might need a db guy of, well, maybe not your stature, but more than
mine. Send me whatever you've got for a price schedule and let me see what I
can do.
> 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
Woop woop woop woop error error missing paren *right here*
Isn't that a much better error message?
> 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?
Nice trick. I'll remember that.
Tenks. Again.
joel
More information about the thelist
mailing list