How do I use a variable in a TOP clause in SQL Server 2000?
CREATE PROCEDURE dbo.getFoo
@top INT
AS
BEGIN
SET ROWCOUNT @top
SELECT foo
FROM blat
ORDER BY foo DESC
-- never forget to set it back to 0!
SET ROWCOUNT 0
END
GO