SQL Server 2005 Query

Posted on 2007-07-30
Medium Priority
Last Modified: 2010-07-27
Need a query to read current "min_server_memory" and then set it to "min_server_memory+1"
Question by:ourguru
LVL 25

Expert Comment

ID: 19594956
if this value is in a table and you know its name and have permissions, you could do the query like this, o

Update whatevertable SET min_server_memory=min_server_memory+1

However this would need a where clause, if min_server_memory is the primarykey of a table and in such case, I'd assume the value would be a field and you'd want to do something like:

update whatevertable SET value=value=1 where keyfield="min_server_memory"

I don't have SQL 2005 on this machine, so I couldn't find the table having this value to see how it is i setup. This is the basic way to do it.

Author Comment

ID: 19595027
This is a Server Setting updated with sp_configure, I don't know that these values are stored in a table...
LVL 10

Accepted Solution

ksaul earned 2000 total points
ID: 19595274
Never actualy done this but you can read the value from sys.configurations
select value_in_use
from sys.configurations
where name = 'min server memory (MB)'

You should not update system tables directly - use sp_configure.  So something like this might work:

declare @minservmem sql_variant,
      @minservmemint int

select @minservmem = value_in_use
from sys.configurations
where name = 'min server memory (MB)'

set @minservmemint = convert(int, @minservmem) + 1

exec sp_configure 'min server memory (MB)', @minservmemint



Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question