1 Reply Latest reply on Mar 12, 2015 1:07 PM by pthivierge

    pioledb query to delete negative values from one attribute for multiple fields together

    shafquet

      pioledb query to delete negative values from one attribute for multiple fields together

        • Re: pioledb query to delete negative values from one attribute for multiple fields together
          pthivierge

          Hello Mr. Iftekhar,

           

          Are you talking about OLEDB Provider or OLEDB Enterprise?

          Ahve you done anything so far?

          --

          OLEDB Enterprise is Read-Only from the manual P21, so you cannot use it for the deletion task :

          PI OLEDB Enterprise also provides read-only access to data from PI Servers

           

          You can however get tag names, for a specific element like this:

          -- use database1
           SELECT ea.Name, ea.description ,gp.tag
           FROM [Asset].[ElementHierarchy] eh
           INNER JOIN [Asset].[ElementAttribute] ea ON ea.ElementID = eh.ElementID
           INNER JOIN (SELECT id FROM [Asset].[Element] where name = 'P-244') e on e.id=eh.ElementId
           CROSS APPLY [CasesDatabase].[Asset].[GetPIPoint] 
           (
              ea.ID -- ElementAttributeID
           ) gp
          OPTION(FORCEORDER)
          

           

          Then your only option for deletion using OLEDB remains PI OLEDB Provider, but this requires that you known the name of the tags that you need to delete from.  Example inspired from Manual P.59:

          DELETE piarchive..picomp2
          WHERE tag in ('sinusoid', 'cdt158', 'etc') AND time = '2015-03-12 13:55:00'
          
          

           

           

          Hope this helps, and if you give more details on what you are trying to achieve we may be in a better position to help.

           

          Regards.