Welcome to Sign in | Help

Re: t-sql update sql server 2000

  •  02-17-2009, 4:32 PM

    Re: t-sql update sql server 2000

    syntaxa e gresita

    am eroarea

    Msg 1033, Level 15, State 1, Line 14

    The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.

    si daca folosesc top 100 percent adica:

    UPDATE aaa SET Principal=0

    WHERE DataInregistrare = (

    SELECT top 100 percent MIN(DataInregistrare) FROM aaa b

    WHERE b.CodContract=aaa.CodContract

    AND DataInregistrare>(

    SELECT MIN(DataInregistrare) FROM aaa c

    WHERE c.CodContract=aaa.CodContract

    )

    AND DATEDIFF(month, DataInregistrare, (

    SELECT MIN(DataInregistrare) FROM aaa d

    WHERE d.CodContract=aaa.CodContract

    ))=0

    ORDER BY DataInregistrare

    )

    am eroarea

    Msg 8127, Level 16, State 1, Line 1

    Column "aaa.DataInregistrare" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.

    alex.

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems