添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

SWQL: Ability to convert data type from nvarchar to numeric?

Hello Orion SDK Community,

I hope I'm just unaware of the ability to convert string data to a number -

I'm attempting to determine (based on the polling frequency of an application template) the approximate "weight" of the components for an application monitor.

To that end, I'm pulling the value from the Orion.APM.ApplicationTemplateSettings table, where the key is  "___Frequency".

When I attempt to include that value in any numeric functions ( SWQL Functions · solarwinds/OrionSDK Wiki · GitHub ) I get the message: "Arithmetic overflow error converting nvarchar data type to type numeric".

Are there any tricks (or something really simple I'm missing) that would let me perform a numeric function/operation with the "value" from Orion.APM.ApplicationTemplateSettings?

Thank you,


=swql

Hello and thank you for the response -

The following query works - I may have already found a resolution in changing up the way I was calculating this. In a previous query if I used "(Value / 1.0)" this would cause the error that I had mentioned. Instead I used  ( 300 * 1.0 / Value ) which avoids that error.

Example Query:

SELECT

Count(c.ComponentID) as SAM_Elements,

((300 * 1.0) / Value) as PollingWeight,

Count(c.ComponentID) * ((300 * 1.0) / Value) as Weighted_SAM_Elements,

n.NodeID,

n.EngineID

FROM Orion.APM.Component c

JOIN Orion.APM.Application a ON c.ApplicationID = a.ApplicationID

JOIN Orion.APM.ApplicationTemplateSettings ats ON a.ApplicationTemplateID = ats.ApplicationTemplateID

JOIN Orion.Nodes n ON a.NodeID = n.NodeID

WHERE Key = '__Frequency'

GROUP BY n.NodeID, n.EngineID, ats.Value

Thank you,

=swql

SolarWinds solutions are rooted in our deep connection to our user base in the THWACK ® online community. More than 195,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.