Sometimes updating in bulk through the UI can be cumbersome, and so the Orion API exposes methods to accomplish the most frequent tasks. Some other times however it may be necessary to go straight to the DB to perform the necessary updates.
In this example, a user needs to make changes to a list of NodeIDs in the ADM_NodeSettings table. The list of target agents of interest is in the AgentManagement_AgentPlugins table which does not include the NodeID, but rather the AgentID Joining on the AgentManagement_Agents table the following query will make the required update.
UPDATE ADM_NodeSettings SET enabled = 0 WHERE nodeid IN ( ( SELECT DISTINCT(AG.NodeId) FROM AgentManagement_AgentPlugins AP INNER JOIN AgentManagement_Agents AG ON AP.AgentId = AG.AgentId WHERE StatusMessage IS NULL ) )
And of course, as always, make sure you have a backup of your DB before making any changes and never test in production :-) If you like to be extra cautious start a transaction with
BEGIN TRANSACTION;
Then execute your query, if the number of rows updated mathces your expectations, you canCOMMIT
or if notROLLBACK