Restrict memory usage on Microsoft SQL Server / SQL Express (How to)


In order to verfiy the current memory restriction on your SQL Server / SQL Express you can run the query "currentmemory.sql" attached.

To define a new memory restriction you can run the query "setmaxmemory.sql".

The query is currently set to 256MB, you can edit the value depending on your needs:

EXEC sp_configure 'max server memory (MB)', 256;

-- here the max memory used by the sql instance is 256MB

Further details can be found in Microsoft KB 178067



File Type sqlsetmaxmemory.sql

File Type sqlcurrentmemory.sql


Link to original article