How to define de TOP value into a VAR in AdvanceQuery

How to define de TOP value into a VAR in AdvanceQuery

  
Hi,

Need some help how do i use a variable in a TOP clause in SQL AdvanceQuery.

I tried the above code, but i receive "can´t Create a Procedure":

CREATE PROCEDURE GetNames
@top INT
AS
BEGIN
SET ROWCOUNT @top

SELECT Name
FROM TableUsers
ORDER BY Name DESC

SET ROWCOUNT 0
END
GO

Thanks
Hi Ivan,

Have you tried to set an Advanced Query as:

SELECT @Top Name
FROM TableUsers
ORDER BY Name DESC

and set the Top parameter as Expand inline (http://www.outsystems.com/help/servicestudio/4.1/Default.htm#using_data/advanced_input_parameter_properties.htm)?


Best Regards,
Fernando Sousa