Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQl Server 2008 Function Error Expand / Collapse
Author
Message
Posted Friday, December 3, 2010 2:12 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Sunday, August 31, 2014 1:00 AM
Points: 464, Visits: 1,036
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
Post #1030157
Posted Friday, December 3, 2010 3:19 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 1,101, Visits: 5,288
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

Post #1030179
Posted Friday, December 3, 2010 4:31 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Sunday, August 31, 2014 1:00 AM
Points: 464, Visits: 1,036
It works thanks, but can you explain why?


--SQLFRNDZ
Post #1030198
Posted Sunday, December 5, 2010 9:25 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 1,101, Visits: 5,288
I added a SUM in the second line and corrected the wrongly placed brackets.
Post #1030433
Posted Monday, December 6, 2010 3:24 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Sunday, August 31, 2014 1:00 AM
Points: 464, Visits: 1,036
Thanks,


--SQLFRNDZ
Post #1030889
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse