Delete Scanning Server
This Store procedure is designed to delete a duplicate server after reinstallation where InstallationID of new server is the one to replace the old server.
Step-by-step guide
- Open SQL Management Studio and connect to database
- Open New Query
- Run the sql below to create a store procedure
- Determine server you wish to delete
- Select * from config.t_server
- Run [model].[deleteServer] "ServerID to delete"
Delete Script
USE [iQSonarSE] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [model].[deleteServer] @ServerID INT AS BEGIN SET NOCOUNT ON; SET XACT_ABORT ON; -- delete server update jobs.t_Job set ServerID =(select max(ServerID) from config.t_Server where ServerID !=@serverId) update config.t__Location_Server set ServerID =(select max(ServerID) from config.t_Server where ServerID !=@serverId) delete from config.t_ServerMetric where ServerID=@serverId delete from config.t_LinkedConnectionConfigurationPort where LinkedConnectionConfigurationID in(select LinkedConnectionConfigurationID from config.t_LinkedConnectionConfiguration where ServerID =@serverId) delete from config.t_LinkedConnectionConfigurationOption where LinkedConnectionConfigurationID in(select LinkedConnectionConfigurationID from config.t_LinkedConnectionConfiguration where ServerID =@serverId) delete from config.t_LinkedProductAdapterConfigurationOption where LinkedProductAdapterConfigurationID in ( select LinkedProductAdapterConfigurationID from config.t_LinkedProductAdapterConfiguration where ServerID =@serverId) delete from config.t_LinkedProductAdapterConfiguration where ServerID =@serverId delete from config.t__Server_ProductAdapterConfiguration where ServerID =@serverId delete from config.t_LinkedConnectionConfiguration where ServerID =@serverId delete from config.t_Server where ServerID =@serverId END
Related articles