Stored Procedure - SQL Block Order Syntax
Posted on 2010-09-06
I am receiving "Incorrect syntax near keyword ORDER" when saving the procedure after editing the SQL block. What would be the correct syntax? Without the ORDER BY the procedure is correct. IDPreAlert is the PK.
ALTER PROCEDURE dbo.floydsp_TreeViewCompanyFillCompany
This sp returns all rows from table PreAlerts for a passed IDCompany
(SELECT TOP (100) PERCENT IDPreAlert, IDCompany, CompanyName
WHERE (IDCompany = @idcompany)
ORDER BY IDPreAlert)