Welcome to Sign in | Help
in Search

sql server 2000 cursor + order by

Last post 02-11-2008, 6:38 PM by Alex. 1 replies.
Sort Posts: Previous Next
  •  02-11-2008, 6:33 PM 3974

    sql server 2000 cursor + order by

    salut, am si eu o eroare de syntaxa (sper) dar nu-mi dau seama ce si cum....am cursorul de mai jos

    declare curs cursor for (select id from altele where id = @id or id = 0x)
    open curs
    fetch next from curs into @aux_id
    while @@fetch_status = 0
    begin

    -------

    end
    fetch next from curs into @aux_id
    close curs
    deallocate curs

    totul merge ok...doar ca nu-mi ordoneaza cum trebuie si in concluzie am incercat sa-i bag un order by

    deci sa-l fac astfel

    declare curs cursor for (select id from altele where id = @id or id = 0x order by id asc)
    open curs
    fetch next from curs into @aux_id
    while @@fetch_status = 0
    begin

    -------

    end
    fetch next from curs into @aux_id
    close curs
    deallocate curs

    si primesc eroarea

    Server: Msg 156, Level 15, State 1, Line 27
    Incorrect syntax near the keyword 'order'.

    care nu reusesc sa-mi dau seama de la ce.

    multumesc mult.

    alex.

  •  02-11-2008, 6:38 PM 3975 in reply to 3974

    Re: sql server 2000 cursor + order by

    rezolvat.

    am scos parantezele de la select

    alex.

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems