labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_DeleteComputer
Parameters
Name
Type
Mode
CID
int
IN
COMMENT
varchar(100)
IN
Definition
BEGIN INSERT INTO retiredassets (ClientID,LocationID,NAME,OS,Windir,VERSION,BiosName,BiosVer,BiosMFG,BiosFlash,USB,Tape,Sound,SCSI,SERIAL,Parallel,COMMENT,MEMORY,Video,Processors,Nic,DNSInfo,LocalAddress,RouterAddress,Modems,AssetTag,Assetdate,RetiredDate,RetireComments,ComputerID,`Password`) (SELECT ClientID,LocationID,NAME,OS,Windir,VERSION,BiosName,BiosVer,BiosMFG,BiosFlash,USB,Tape,Sound,SCSI,SERIAL,Parallel,COMMENT,(SELECT GROUP_CONCAT(CONCAT(Size,':',MemoryType,':',0,':',Speed,':',0,':',0) SEPARATOR '|') FROM Inv_memoryslots WHERE Size>0 AND computerid=computers.computerid),Video,(SELECT GROUP_CONCAT(CONCAT(NAME,':0:',Speed,':',32,':',Family,':',L2Cache,':',Manufacturer,':',SerialNumber,':0:0') SEPARATOR '|') FROM inv_processor WHERE Enabled>0 AND computerid=computers.computerid),Nic,DNSInfo,LocalAddress,RouterAddress,Modems,AssetTag,Assetdate,NOW(),COMMENT,CID,`Password` FROM Computers WHERE ComputerID=CID) ON DUPLICATE KEY UPDATE `ClientID`=VALUES(`ClientID`),`LocationID`=VALUES(`LocationID`),`NAME`=VALUES(`NAME`),`OS`=VALUES(`OS`),`Windir`=VALUES(`Windir`),`VERSION`=VALUES(`VERSION`),`BiosName`=VALUES(`BiosName`),`BiosVer`=VALUES(`BiosVer`),`BiosMFG`=VALUES(`BiosMFG`),`BiosFlash`=VALUES(`BiosFlash`),`USB`=VALUES(`USB`),`Tape`=VALUES(`Tape`),`Sound`=VALUES(`Sound`),`SCSI`=VALUES(`SCSI`),`SERIAL`=VALUES(`SERIAL`),`Parallel`=VALUES(`Parallel`),`COMMENT`=VALUES(`COMMENT`),`MEMORY`=VALUES(`MEMORY`),`Video`=VALUES(`Video`),`Processors`=VALUES(`Processors`),`Nic`=VALUES(`Nic`),`DNSInfo`=VALUES(`DNSInfo`),`LocalAddress`=VALUES(`LocalAddress`),`RouterAddress`=VALUES(`RouterAddress`),`Modems`=VALUES(`Modems`),`AssetTag`=VALUES(`AssetTag`),`Assetdate`=VALUES(`AssetTag`),`RetiredDate`=VALUES(`RetiredDate`),`RetireComments`=VALUES(`RetireComments`),`Password`=VALUES(`Password`); INSERT INTO retiredComputerConfig SELECT * FROM computerconfig WHERE computerconfig.computerid=CID; DELETE FROM computers WHERE ComputerID=CID; DELETE FROM defragmentation WHERE ComputerID=CID; DELETE FROM drives WHERE ComputerID=CID; DELETE FROM errorlogs WHERE ComputerID=CID; DELETE FROM eventlogs WHERE ComputerID=CID; DELETE FROM network WHERE ComputerID=CID; DELETE FROM networkdrives WHERE ComputerID=CID; DELETE FROM hotfix WHERE ComputerID=CID; DELETE FROM printers WHERE ComputerID=CID; DELETE FROM processes WHERE ComputerID=CID; DELETE FROM smartattributes WHERE ComputerID=CID; DELETE FROM software WHERE ComputerID=CID; DELETE FROM services WHERE ComputerID=CID; DELETE FROM autostartup WHERE ComputerID=CID; DELETE FROM subgroups WHERE ComputerID=CID; DELETE FROM subgroupwchildren WHERE ComputerID=CID; DELETE FROM computerconfig WHERE ComputerID=CID; DELETE FROM scheduledscripts WHERE ComputerID=CID; DELETE FROM pendingscripts WHERE ComputerID=CID; DELETE FROM runningscripts WHERE ComputerID=CID; DELETE FROM scheduledtasks WHERE ComputerID=CID; DELETE FROM autofixignore WHERE ComputerID=CID; DELETE FROM agentignore WHERE ComputerID=CID; DELETE FROM agentcomputerdata WHERE ComputerID=CID; DELETE FROM datacache WHERE ComputerID=CID; DELETE FROM h_commands WHERE ComputerID=CID; DELETE FROM h_computers WHERE ComputerID=CID; DELETE FROM h_processes WHERE ComputerID=CID; DELETE FROM h_redirector WHERE ComputerID=CID; DELETE FROM h_scripts WHERE ComputerID=CID; DELETE FROM h_eventlogs WHERE ComputerID=CID; DELETE FROM agents WHERE checkaction>0 AND ComputerID=CID; DELETE FROM Alerts WHERE ComputerID=CID; DELETE FROM Databasealerts WHERE ComputerID=CID; DELETE FROM h_apps WHERE ComputerID=CID; DELETE FROM extrafielddata WHERE ID=CID AND ExtraFieldID IN (SELECT ID FROM ExtraField WHERE Form=1); DELETE FROM heartbeatcomputers WHERE ComputerID=CID; DELETE FROM inv_bios WHERE ComputerID=CID; DELETE FROM inv_chassis WHERE ComputerID=CID; DELETE FROM inv_devices WHERE ComputerID=CID; DELETE FROM inv_memoryslots WHERE ComputerID=CID; DELETE FROM inv_networkcard WHERE ComputerID=CID; DELETE FROM inv_operatingsystem WHERE ComputerID=CID; DELETE FROM inv_probefansensor WHERE ComputerID=CID; DELETE FROM inv_processor WHERE ComputerID=CID; DELETE FROM inv_systemslots WHERE ComputerID=CID; DELETE FROM inv_videocard WHERE ComputerID=CID; DELETE FROM antivirusthreats WHERE ComputerID=CID; DELETE FROM computerpatchingstats WHERE ComputerID=CID; DELETE FROM computerpatchpolicies WHERE ComputerID=CID; DELETE FROM patchgroupapprovalpolicies WHERE ComputerLevelOverride=CID; DELETE FROM patchgrouppolicies WHERE ComputerLevelOverride=CID; DELETE FROM patchhistory WHERE ComputerID=CID; DELETE FROM PatchingDeviceComplianceData WHERE ComputerID=CID; END