To set the maximum SQL Server Memory on the instance of SQL Server. Please bear in mind that you need to leave certain megabytes / GB for the OS level. Below is the script to set the SQL Server memory with maximum of 8 GB.
This change can be done via SQL Server Management Studio and also through the T-SQL Scripts.
Below T-SQL Scripted tested on SQL Server 2016
EXEC sys.sp_configure N'show advanced options', N'1' RECONFIGURE WITH OVERRIDE GO EXEC sys.sp_configure N'max server memory (MB)', N'8192' GO RECONFIGURE WITH OVERRIDE GO EXEC sys.sp_configure N'show advanced options', N'0' RECONFIGURE WITH OVERRIDE GO