Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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

  1. Open SQL Management Studio and connect to database
  2. Open New Query
  3. Run the sql below to create a store procedure
  4. Determine server you wish to delete 
    1. Select * from config.t_server
  5. Run [model].[deleteServer] "ServerID to delete" 


USE [iQSonarSE]
GO
/****** Object: StoredProcedure [jobs].[Job_Create] Script Date: 15.03.2017 13:19:48 ******/
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__Server_ProductAdapterConfiguration where ServerID =@serverId
delete from config.t_LinkedConnectionConfiguration where ServerID =@serverId
delete from config.t_Server where ServerID =@serverId



END



  • No labels