Order By in function???

  • Hi Guys/Girls,

    I've got a function that returns multiple rows into a single line of html.

    Now the select part of that query looks as follows.

    The user wants the names listed in descending form in the html. Here is the selct part of the query.

    This still returns multiple lines, but the lines should be listed by name desc

    However: It gives me on the order by clause

    Msg 156, Level 15, State 1, Procedure f_StockItemDepoQuantitySelect, Line 67

    Incorrect syntax near the keyword 'Order'.

  • Can you post full text of procedure f_StockItemDepoQuantitySelect?

    Or at least first 70 rows, where the error happens.

    _____________
    Code for TallyGenerator

  • The error line was Order By

    Reasaon for that is that Order By is not allowed in function.

    However the client requirement was only that the warehouse be listed 1st.

    So what I did was to do a union select.

    Select everything where the name is warehouse

    union

    select everything else

    Ugly, but it works 😀

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply