labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_FixMasterGroups
Parameters
Name
Type
Mode
GID
int
IN
CID
int
IN
NID
int
IN
CONTID
int
IN
Definition
BEGIN IF (SELECT MASTER FROM MASTERGROUPS WHERE GroupID=GID)=1 THEN IF CID > 0 THEN DELETE FROM SUBGROUPS WHERE GROUPID NOT IN (SELECT GroupID From MasterGroups Where Master>0) AND COMPUTERID=CID; ELSEIF NID > 0 THEN DELETE FROM subgroupsnetworkdevices WHERE groupID NOT IN (SELECT groupID FROM MasterGroups WHERE Master>0) AND deviceID=NID; ELSEIF CONTID > 0 THEN DELETE FROM subgroupscontacts WHERE groupID NOT IN (SELECT groupID FROM MasterGroups WHERE Master>0) AND contactID=CONTID; END IF; END IF; END