I'm trying to automate my sql server installs and as part of this I want to run some scripts after the install has been done to set certain features
One of these is to set the maximum sql server memory, I do this based on a formula looking at the total server memory.
For simplicity's sake I have just set it to 2000mb in the example
declare @max_sql_memory int
set @max_sql_memory = 2000
sp_configure 'max server memory (MB)', @max_sql_memory
this does not work, it appears that sp_configure must be the first command in a batch and it also doesn't allow you to pass in variables for sp_configure values.
Is there any way to make the above command work?
If not, what is the alternative?