1 Reply Latest reply on Oct 2, 2017 8:39 PM by mesverrum

    SQL and SWQL

    brentbo

      Hi Thwacknatians,

       

      I have an SQL solution to a database file i/o problem generously provided by Tony.Johnson here in Thwack. However, in my environment I can't run pure SQL, I'm limited to SWQL. This code throws an invalid query error. Ideas why?

      SELECT Volumes.FullName, Volumes.VolumeID FROM Volumes

      WHERE VolumeID in (

      SELECT        Distinct(Volumes.VolumeID)

      FROM            dbo.Volumes INNER JOIN

                               dbo.APM_SqlBbDatabaseFileAlertsData ON dbo.Volumes.VolumeID = dbo.APM_SqlBbDatabaseFileAlertsData.VolumeID

      WHERE dbo.APM_SqlBbDatabaseFileAlertsData.VolumeLatencyInMilliseconds  < 15

      )

       

      Thanks!

        • Re: SQL and SWQL
          mesverrum

          I can't imagine anything beside some kind of weird policy that would stop you from executing that alert exactly as written in SQL in the alert box by just using the appropriate selection on the drop down, but in any case the table names in swql are slightly different than SQL and some syntax gets reworked slightly. Try this:

           

          WHERE VolumeID in (

          SELECT        Distinct(Volumes.VolumeID)

          FROM            orion.Volumes v

                                JOIN orion.apm.SqlDatabaseFileAlert db ON v.VolumeID = db.VolumeID

          WHERE db.VolumeLatencyInMilliseconds  > 15 --Note that I changed you from a less than to a greater since I assume you did not mean to alert on fast disks, if I misunderstood then switch this back

          )

           

           

          Using SQL

          Using SWQL