Jump to content

SQL to append a tag to all auto-join searches


Recommended Posts

Another one from the Slack files, this one courtesy of @MartynKeigher :)

Appends a '*' to the name of all searches being used by a group to join agents or network devices:

UPDATE sensorchecks SET `name` = LEFT(`name`,LENGTH(`name`)-1) WHERE `Name` LIKE '%*'; 
UPDATE sensorchecks SET `name` = CONCAT(`sensorchecks`.`name`, '*') WHERE sensid IN (SELECT autojoinscript FROM mastergroups) AND `name` NOT LIKE '%*';
UPDATE sensorchecks SET `name` = CONCAT(`sensorchecks`.`name`, '*') WHERE sensid IN (SELECT networkjoin FROM mastergroups) AND `name` NOT LIKE '%*';
UPDATE sensorchecks SET `name` = CONCAT(`sensorchecks`.`name`, '*') WHERE sensid IN (SELECT searchid FROM groupagents) AND `name` NOT LIKE '%*';

 

Edited by MetaMSP
clarifying topic
  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...