Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Friday, March 23, 2012

Merge 2 queries

Hi all i have 2 queries. One of which works out where 2 values are equal and the other where where all value are there.. This is in order for me to divid one by another to get percentage.

THIS IS FOR ALL
select results.playerid, players.playername, count (results.playerid) as allgames
from results, players
where results.playerid = players.playerid
group by results.playerid, players.playername
order by allgames desc

THIS IS FOR WON
select results.playerid, players.playername, count (results.result) as wongames
from results, players
where results.result = 1 and
results.playerid = players.playerid
group by results.result, results.playerid, players.playername
order by results.playerid asc

I can make them have the same view output...

How can i merge them into one to get percentage.. Ideally i would like to this on the fly because once i have all the result i want i want to do a front end on the net.

I am using SQL server Enterprise Manage.

Thanks in advance.declare @.var1 float, @.var2 float, @.var3 float

set @.var1 = (select count (results.playerid) from results, players where results.playerid = players.playerid)
set @.var2 = (select count (results.result) as wongames from results, players where results.result = 1 and results.playerid = players.playerid)

set @.var3 = @.var2/@.var1 * 100

select @.var3
--or--
select convert(varchar(50),@.var3)+'%'|||thank you!! i'll try it tomorrow.|||is this method only able to send single value???

"Subquery returned more than 1 value"

Monday, March 19, 2012

Memory usage in Task Manager

Hallo,

I am a newbie on SQL server and my problem is this:

My SQL server runs with many client queries and after a while I can observe that the meory usage of the SQL server shown in the Windows Task Manager is growing up (e.g. 260 MB !!!).

I checked the online books and found the settings "min/max server memory" which I set to

min = 4 MB
max = 20 MB

by Enterprise manager.

Then I restarted my SQL server, checked the memory settings again by Enterprise manager and started many client queries. The memory usage in Task Manager nevertheless exeeded the 20 MB.

What is my failure? How can I limit the memory usage of SQL server?

Thank you very much for any help...After the change, did you stop and restart SQL?

Friday, March 9, 2012

Memory Reserve

Hi All
I just want to know when some queries has completed on SQL 2000 whether the
memory that reserved for it will release after completion the process.
In current sql server which Im using having major issue with memory usage.
It is catching memory when some process is happening, but it won't release
that memory even after hours of that process took place.
Please send some advise
Thaks in advance
JanakaReleasing the memory after a query has executed would defeat the whole purpose of caching data. We
do not want that. I suggest you investigate the issue further and see if it is a real problem to you
(how do you determine that the behavior of SQL Server is a problem), and if for instance setting a
max for memory solves your problem. Have a look at
INF: SQL Server Memory Usage
http://support.microsoft.com/default.aspx?scid=kb;en-us;q321363
http://www.mssqlserver.com/faq/troubleshooting-memoryleak.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Janaka Sampath" <janakaj@.lankaequities.com> wrote in message
news:uubaDh27FHA.3976@.TK2MSFTNGP15.phx.gbl...
> Hi All
>
> I just want to know when some queries has completed on SQL 2000 whether the
> memory that reserved for it will release after completion the process.
> In current sql server which Im using having major issue with memory usage.
> It is catching memory when some process is happening, but it won't release
> that memory even after hours of that process took place.
>
> Please send some advise
> Thaks in advance
> Janaka
>

Memory Reserve

Hi All
I just want to know when some queries has completed on SQL 2000 whether the
memory that reserved for it will release after completion the process.
In current sql server which Im using having major issue with memory usage.
It is catching memory when some process is happening, but it won't release
that memory even after hours of that process took place.
Please send some advise
Thaks in advance
Janaka
Releasing the memory after a query has executed would defeat the whole purpose of caching data. We
do not want that. I suggest you investigate the issue further and see if it is a real problem to you
(how do you determine that the behavior of SQL Server is a problem), and if for instance setting a
max for memory solves your problem. Have a look at
INF: SQL Server Memory Usage
http://support.microsoft.com/default...;en-us;q321363
http://www.mssqlserver.com/faq/troub...memoryleak.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Janaka Sampath" <janakaj@.lankaequities.com> wrote in message
news:uubaDh27FHA.3976@.TK2MSFTNGP15.phx.gbl...
> Hi All
>
> I just want to know when some queries has completed on SQL 2000 whether the
> memory that reserved for it will release after completion the process.
> In current sql server which Im using having major issue with memory usage.
> It is catching memory when some process is happening, but it won't release
> that memory even after hours of that process took place.
>
> Please send some advise
> Thaks in advance
> Janaka
>

Memory Reserve

Hi All
I just want to know when some queries has completed on SQL 2000 whether the
memory that reserved for it will release after completion the process.
In current sql server which Im using having major issue with memory usage.
It is catching memory when some process is happening, but it won't release
that memory even after hours of that process took place.
Please send some advise
Thaks in advance
JanakaReleasing the memory after a query has executed would defeat the whole purpo
se of caching data. We
do not want that. I suggest you investigate the issue further and see if it
is a real problem to you
(how do you determine that the behavior of SQL Server is a problem), and if
for instance setting a
max for memory solves your problem. Have a look at
INF: SQL Server Memory Usage
http://support.microsoft.com/defaul...b;en-us;q321363
http://www.mssqlserver.com/faq/trou...-memoryleak.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Janaka Sampath" <janakaj@.lankaequities.com> wrote in message
news:uubaDh27FHA.3976@.TK2MSFTNGP15.phx.gbl...
> Hi All
>
> I just want to know when some queries has completed on SQL 2000 whether th
e
> memory that reserved for it will release after completion the process.
> In current sql server which Im using having major issue with memory usage.
> It is catching memory when some process is happening, but it won't release
> that memory even after hours of that process took place.
>
> Please send some advise
> Thaks in advance
> Janaka
>