Содержание
MSSQL ликбез
Минимум о MSSQL, если знаешь MySQL.
LIMIT
For SQL Server 2012 +
SELECT * FROM TABLE ORDER BY name OFFSET 5 ROWS FETCH NEXT 5 ROWS ONLY
или
WITH Documents AS ( SELECT ID, DATA, ROW_NUMBER() OVER (ORDER BY ID) AS 'RowNumber' FROM Document ) SELECT * FROM Documents WHERE RowNumber BETWEEN 10 AND 20;
или для версии 2000 и ниже:
SELECT TOP 10 * FROM (SELECT TOP 20 FROM Table ORDER BY Id) ORDER BY Id DESC
Версия сервера MSSQL
SELECT @@VERSION
Размер базы данных
EXEC sp_spaceused