i am creating a procudure for temp table.
IF EXISTS (SELECT TEMP1.*,TEMP1.Total + (SELECT COALESCE(SUM(Total),0) FROM TEMP1 t1 WHERE t1.ROWNO<TEMP1.ROWNo)as TotalAmount FROM TEMP1
ORDER BY OrderID
)
DROP TABLE TEMP1
in this i am getting error,
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
please help me how to resolve this???