SELECT TOP n rows July 23, 2015 4:12 pm \ by John Perry I love how top can accept a variable. You could pass it into a procedure. DECLARE @vcOut VARCHAR(MAX), @nTop INT SELECT @nTop = 5 SELECT TOP (@nTop) @vcOut = COALESCE(@vcOut, '') + NAME + CHAR(10) FROM sys.sysdatabases PRINT @vcOut -- Posted in: Coding, SQL