Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQl Server 2008 Function Error


SQl Server 2008 Function Error

Author
Message
@SQLFRNDZ
@SQLFRNDZ
Mr or Mrs. 500
Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)

Group: General Forum Members
Points: 523 Visits: 1175
I'm running a query like this


select sum(signal_wait_time_ms) as signal_waits_time_ms
,CAST(100* (signal_wait_time_ms/sum(wait_time_ms as numeric(20,2)))) as %signal_cpu_waits
,sum((wait_time_ms-signal_wait_time_ms))as resource_wait_time_ms
,cast(100*(sum(wait_time_ms-signal_wait_time_ms)/sum(wait_time_ms)as numeric(20,2))) as '%resource waits'
from sys.dm_os_wait_stats
GO


I'm getting the error:

Msg 195, Level 15, State 10, Line 2
'sum' is not a recognized built-in function name.

I used to use it before it works fine in 2005 but when I try in 2008 version
I'm getting this error
Suggest me.

Sql Server 2008 Edition.


--SQLFRNDZ

Suresh B.
Suresh B.
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1128 Visits: 5326
select sum(signal_wait_time_ms) as signal_waits_time_ms
,CAST(100* (sum(signal_wait_time_ms)/sum(wait_time_ms)) as numeric(20,2)) as [%signal_cpu_waits]
,sum(wait_time_ms-signal_wait_time_ms) as [resource_wait_time_ms]
,cast(100*(sum(wait_time_ms-signal_wait_time_ms)/sum(wait_time_ms)) as numeric(20,2)) as ['%resource waits']
from sys.dm_os_wait_stats


@SQLFRNDZ
@SQLFRNDZ
Mr or Mrs. 500
Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)

Group: General Forum Members
Points: 523 Visits: 1175
It works thanks, but can you explain why?


--SQLFRNDZ

Suresh B.
Suresh B.
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1128 Visits: 5326
I added a SUM in the second line and corrected the wrongly placed brackets.
@SQLFRNDZ
@SQLFRNDZ
Mr or Mrs. 500
Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)Mr or Mrs. 500 (523 reputation)

Group: General Forum Members
Points: 523 Visits: 1175
Thanks,


--SQLFRNDZ

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search